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 tap mahope/clean-copy
brew install 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](intact)

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.

Frequently asked questions

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

Install Clean Copy (brew tap mahope/clean-copy && brew install 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.

Does the conversion keep links, headings and tables?

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.

Get the Clean Copy CLI free →

Related: Paste as Markdown in VS Code · HTML to Markdown Converter (online) · URL to Markdown Converter · Copy as Markdown in Chrome