Single static Go binary with no runtime dependencies. Configurable conversion via per-element options (bold delimiter, table cell padding, header promotion). Supports CSS selectors to include or exclude page regions before conversion. Resolves relative URLs to absolute when given --domain. Bidirectional pipeline-friendly (pairs cleanly with curl, monolith, or pandoc).
Notes
Default plugin is CommonMark; enable --plugin-table and --plugin-strikethrough for GFM features. When --input is a directory or glob, --output must also be a directory. Use --output-overwrite to replace existing files. Output is not sanitized: if the resulting Markdown will be re-rendered to HTML, run it through an HTML sanitizer first.
Used by
Documentation pipelines, web scraping workflows, AI ingestion of HTML pages into Markdown for LLM context
Version
Latest known: 2.5.1 (2026-05-07)
Try it
Show installed version
Run 'html2markdown --version' to display the installed binary version, commit hash, and build date.
Convert an HTML file to Markdown (CommonMark)
Convert the shared sample HTML document to CommonMark Markdown. The default plugin emits headings, lists, code spans, and paragraphs but skips tables.
Convert with GFM table and strikethrough plugins
Same input as the basic demo but with --plugin-table and --plugin-strikethrough enabled, so the HTML <table> renders as a GitHub Flavored Markdown table.
Customize bold delimiter to underscores
Override the CommonMark default with --opt-strong-delimiter=__ so <strong> renders as __bold__ instead of **bold**.
# html2markdown - Help
Source: https://github.com/JohannesKaufmann/html-to-markdown
```
# html2markdown - convert html to markdown [version 2.5.0]
Convert HTML to Markdown. Even works with entire websites!
## Basics
By default the "Commonmark" Plugin will be enabled. You can customize the options,
for example changing the appearance of bold with --opt-strong-delimiter="__"
Other Plugins can also be enabled. For example "GitHub Flavored Markdown" (GFM)
extends Commonmark with more features.
## Relative / Absolute Links
Use --domain="https://example.com" to convert *relative* links to *absolute* links.
The same also works for images.
## Escaping
Some characters have a special meaning in markdown. The library escapes these - if necessary.
See the documentation for more info.
## Security
Once you convert this markdown *back* to HTML you need to be careful of malicious content.
Use a HTML sanitizer before displaying the HTML in the browser!
## Examples
echo "<strong>important</strong>" | html2markdown
curl --no-progress-meter http://example.com | html2markdown
html2markdown --input file.html --output file.md
html2markdown --input "src/*.html" --output "dist/"
## Flags
-v, --version
show the version of html2markdown and exit
--help
--input PATH
Input file, directory, or glob pattern (instead of stdin)
--output PATH
Output file or directory (instead of stdout)
--output-overwrite
Replace existing files
If --input is a directory or glob pattern, --output must be a directory.
--domain
The url of the web page, used to convert relative links to absolute links.
--exclude-selector
css query selector to exclude parts of the input
--include-selector
css query selector to only include parts of the input
--opt-strong-delimiter
Make bold text. Should <strong> be indicated by two asterisks or two underscores?
"**" or "__" (default: "**")
--opt-table-cell-padding-behavior
[for --plugin-table] whether cells in the tables should include extra padding for visual continuity: "aligned", "minimal", or "none"
--opt-table-header-promotion
[for --plugin-table] first row should be treated as a header
--opt-table-newline-behavior
[for --plugin-table] how tables containing newlines should be handled: "skip" or "preserve"
--opt-table-presentation-tables
[for --plugin-table] whether tables with role="presentation" should be converted
--opt-table-skip-empty-rows
[for --plugin-table] omit empty rows from the output
--opt-table-span-cell-behavior
[for --plugin-table] how colspan/rowspan should be rendered: "empty" or "mirror"
--plugin-strikethrough
enable the plugin ~~strikethrough~~
--plugin-table
enable the plugin table
For more information visit the documentation:
https://github.com/Johanneskaufmann/html-to-markdown
```
## Typical invocations
Convert a single HTML file to Markdown:
```
html2markdown --input page.html --output page.md
```
Convert a glob of HTML files into a directory:
```
html2markdown --input "src/*.html" --output "dist/"
```
Convert via stdin/stdout (pipeline-friendly):
```
curl --no-progress-meter https://example.com | html2markdown
```
Resolve relative links and images against a base URL:
```
html2markdown --input page.html --domain https://example.com --output page.md
```
Restrict conversion to a single region of the page:
```
html2markdown --input page.html --include-selector "main article" --output page.md
```
Enable GitHub Flavored Markdown features (tables and strikethrough):
```
html2markdown --input page.html --plugin-table --plugin-strikethrough --output page.md
```
## Notes
- Default plugin is CommonMark. GFM features (tables, strikethrough) require
explicit `--plugin-table` and `--plugin-strikethrough`.
- When `--input` is a directory or glob, `--output` must also be a directory.
- Use `--output-overwrite` to replace existing files; without it, the binary
refuses to clobber.
- Output Markdown is not sanitized. If you re-render it to HTML for browser
display, run it through an HTML sanitizer first.
```