Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Python
  3. html2text

html2text

GPL-3.0Python2025.4.15

A Python library and CLI tool that converts HTML into clean, readable Markdown-formatted plain text.

Visit WebsiteGitHubGitHub
2.2k stars297 forks0 contributors

What is html2text?

html2text is a Python library and command-line utility that converts HTML into clean, readable plain text formatted as Markdown. It solves the problem of extracting meaningful text from web pages or HTML snippets while preserving formatting like bold, italics, and links in a Markdown-compatible way. This makes it useful for developers, writers, and anyone needing to transform HTML content into a more portable text format.

Target Audience

Python developers, technical writers, and content creators who need to programmatically convert HTML to Markdown for documentation, data processing, or content migration tasks.

Value Proposition

Developers choose html2text for its simplicity, configurability, and dual CLI/library interface, offering a straightforward, dependency-light alternative to more complex HTML parsing tools.

Overview

Convert HTML to Markdown-formatted text.

Use Cases

Best For

  • Converting HTML email content to Markdown for documentation
  • Extracting readable text from web pages during scraping projects
  • Migrating blog posts or articles from HTML to Markdown format
  • Preprocessing HTML content for static site generators
  • Integrating HTML-to-text conversion into Python automation scripts
  • Generating plain-text summaries from HTML snippets

Not Ideal For

  • Projects involving JavaScript-rendered HTML content, as html2text only parses static HTML and cannot handle dynamically loaded elements.
  • Applications requiring output formats beyond Markdown, such as LaTeX, RTF, or PDF, since it focuses solely on Markdown conversion.
  • High-volume batch processing where performance and memory efficiency are critical, due to its lightweight, non-optimized design.
  • Systems that must perfectly parse malformed or highly nested HTML without manual intervention, as it may require flags like --escape-all to avoid errors.

Pros & Cons

Pros

Simple Markdown Conversion

Directly converts HTML tags like <strong> to **bold** and <a> to [link](url), as shown in the Python example with Zed's dead baby output.

Configurable Output Options

Offers command-line flags such as --ignore-links and --escape-all, and Python settings like ignore_links for customizable formatting, detailed in the usage section.

Dual Interface Flexibility

Can be used as a CLI tool for quick conversions or imported as a Python library for programmatic integration, demonstrated in the README with both modes.

Lightweight and Easy Setup

Available on PyPI with a simple pip install, has minimal dependencies, and focuses on simplicity without heavy external libraries.

Cons

Limited HTML Robustness

The --escape-all option admits corner case issues, indicating it can struggle with complex or malformed HTML, requiring trade-offs in output readability.

Basic Feature Set

Focuses on core Markdown elements; lacks support for advanced features like tables, nested lists, or modern Markdown extensions, which may limit comprehensive conversions.

Sparse Documentation

Documentation is linked externally and might be incomplete, as the README only provides basic examples, leaving users to explore usage details on their own.

Frequently Asked Questions

Quick Stats

Stars2,169
Forks297
Contributors0
Open Issues84
Last commit8 months ago
CreatedSince 2014

Tags

#python-library#markdown-parser#plain-text#cli-tool#text-processing#python#markdown#html-to-markdown#documentation#web-scraping#content-conversion

Built With

P
Python

Links & Resources

Website

Included in

Python290.8k
Auto-fetched 6 hours ago

Related Projects

browser-usebrowser-use

🌐 Make websites accessible for AI agents. Automate tasks online with ease.

Stars106,426
Forks11,703
Last commit12 hours ago
crawl4aicrawl4ai

🚀🤖 Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper. Don't be shy, join here: https://discord.gg/jP8KfhDhyN

Stars74,708
Forks7,698
Last commit1 day ago
scrapyscrapy

Scrapy, a fast high-level web crawling & scraping framework for Python.

Stars63,366
Forks11,815
Last commit20 hours ago
trafilaturatrafilatura

Python & Command-line tool to gather text and metadata on the Web: Crawling, scraping, extraction, output as CSV, JSON, HTML, MD, TXT, XML

Stars6,332
Forks397
Last commit5 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub