Mahope tools: EUComply Clean Copy DeskUptime Transmute BugBottle All tools
DEVELOPER · CLI · MARKDOWN

HTML to Markdown
from the Terminal

You are already in the shell — why open a browser tab to convert a page? Pipe curl output, dump documentation, feed CI reports: one zero-dependency CLI turns any HTML into clean Markdown without leaving the keyboard.

Updated August 2026 · 5 minute read

Why convert in the terminal at all?

Web-based converters break the moment your input is not a public page: internal wikis, authenticated dashboards, files on disk, gigabyte logs. And copy-pasting through a browser tab does not belong in a script.

Scriptable end to end

A CLI composes with everything else you already use — curl, pandoc, git hooks, cron jobs, GitHub Actions. No browser automation needed.

Nothing leaves your machine

Paste an NDA draft or an internal runbook into an online converter and you have sent it somewhere else. A local CLI keeps every byte on disk.

Zero dependencies

npm install -g pulls hundreds of packages with most converters. A single-file, dependency-free tool installs in seconds and stays auditable.

Your options today

OptionWhat it doesCatch
Online converters Paste HTML in a form, copy Markdown back Manual, uploads your text, no scripting
Pandoc Universal document converter, excellent Markdown out Large binary; treats pages as documents, not as web content
npm html-to-md packages Library you call from Node You have to write the script yourself each time
Clean Copy CLI One command: file, URL or stdin → clean Markdown or plain text Requires Node 16+ (no other dependencies)

The fix: one command, three inputs

Clean Copy CLI is the same converter engine behind the Clean Copy browser extension and VS Code extension, packaged as a single-file Node program.

1. Install

brew install mahope/tap/clean-copy
# or: download the tarball from GitHub releases and drop clean-copy.js on your PATH

2. Convert

# A file on disk
clean-copy article.html

# A live web page
clean-copy -u https://example.com/blog

# A pipe — this is where it shines
curl -sL https://example.com/docs | clean-copy

# macOS clipboard round-trip: dirty HTML in, clean Markdown out
pbpaste | clean-copy | pbcopy

3. Plain text when you need it

clean-copy -t email_dump.html   # strip all formatting, keep readable text

# Headings preserved

H1–H6 map to the right number of #, so document structure survives.

Links become standard Markdown references with original URLs.

Tables → pipe tables

Simple HTML tables become Markdown pipe tables, alignment included.

GitHub Action

There is an official action so CI workflows can convert pages as part of a build.

No terminal on this machine? The same engine also runs in the browser, right here in this page — paste what you copied from a web page, or raw HTML, and copy back clean Markdown:

Check any page for GDPR & cookie issues: Run the Free Scanner →
EAA, NIS2 and GDPR — three free guides that answer it, and a scanner for any public URL: See what we publish free →

The CLI stays free. Pro is for the two jobs a shell loop does badly.

Everything in this guide — the install, the pipes, the URL input, the plain-text mode — is free, and it stays free: no account, no key, no expiry, and no limit on what you feed it. If your workflow is curl into a pipe into a file, you never need to pay for anything.

What a shell loop cannot do is sit in a browser tab. Pro covers the two places where you are not in a terminal — the browser extension and the web tool — and adds the two things that actually cost you time there: converting a whole batch of pasted snippets at once, and cleanup rules you write once and reuse everywhere.

What you getFreeClean Copy Pro — $19/year
The CLI in this guideincluded, forever — file, URL, stdin and plain textincluded
Conversion modes in the extension and on the web toolevery conversion mode in the extension and on the web toolincluded
How much text you can convertno limit on how much text you pasteincluded
Many snippets at once, one per line—batch conversion on the web tool
Your own cleanup rules, defined once—custom cleanup rules in the browser extension
Devices covered by one licence—5

One licence covers 5 machines or installs. If the CLI already does everything you need — and for most pipelines it does — the free version is the whole answer, and it is not a trial.

Buy Clean Copy Pro — $19/year

Frequently asked questions

How do I convert HTML to Markdown from the command line?

Install Clean Copy (brew install mahope/tap/clean-copy, or download the release tarball) and run: clean-copy article.html. For a live page: clean-copy -u https://example.com/blog.

Can I pipe curl output through it?

Yes. The tool reads stdin by default: curl -sL https://example.com | clean-copy. On macOS you can chain it with pbcopy to put the result on your clipboard: pbpaste | clean-copy | pbcopy.

Does it work in CI pipelines?

Yes. There is an official GitHub Action (clean-copy HTML to Markdown) and the CLI itself has zero npm dependencies, so it runs anywhere Node 16+ runs without a heavy install step.

Headings map to # levels, links become [text](url), lists stay lists, bold and italic survive, code blocks become fenced blocks, and simple tables convert to pipe tables — including alignment. Add -t for plain text instead.

Is anything uploaded to a server?

No. The converter is a local Node.js program. Your HTML and URLs never leave your machine, which also makes it safe for internal docs and CI logs.

Dansk version af denne guide

Free e-book: Build Your First Chrome Extension

The complete guide is available as a free EPUB — no signup required.

Get the free e-book →

Want all six guides? Complete EU Compliance Bundle — all six listed together, each a free EPUB.

Keeping websites online? DeskUptime is a free desktop uptime & SSL-expiry monitor for macOS, Linux and Windows.