html-text
Extract text from HTML
Decision gist · record as of 2026-08-14
Yes, if you need to extract clean text from HTML with structure preservation. Low install friction, permissive license, no known vulnerabilities, and stable API make it a safe choice. Maintenance is aging but the repository remains active; suitable for production use in text extraction pipelines.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires lxml, which has compiled C dependencies; installation may need a C compiler or pre-built wheels for your platform.
- Low friction: pure Python wheel with only lxml and lxml-html-clean as runtime dependencies.
- Last release 312 days ago; repository is active and not archived, though maintenance status is aging.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2025-10-06 (312 days) · last repo commit 2025-10-06 · 19 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,433,260 downloads/mo, #3,908 on PyPI
Alternatives
Verify before relying
pip install html-text
import html_text
text = html_text.extract_text('<p>Hello</p><p>world</p>')
print(text)- Whether parsel is an optional dependency or required for selector_to_text functionality
- Performance characteristics on large HTML documents or batch processing scenarios
What it is and what it does
html-text extracts readable text from HTML by removing invisible content (styles, scripts, comments) and normalizing whitespace in a way that mimics how a browser renders the page. Unlike simple XPath or Beautiful Soup text extraction, it adds intelligent spacing around inline elements and can insert newlines after headers and paragraphs to preserve document structure in the output.
The package provides multiple entry points: a high-level extract_text() function for raw HTML strings, lower-level etree_to_text() for pre-parsed lxml trees, and integration with parsel.Selector for targeted extraction from specific elements. It's designed for both display purposes and machine learning feature extraction, where clean, normalized text is needed as input to classification pipelines.
Use it for
- Extract readable text from web pages for search indexing or content aggregation
- Prepare HTML content as features for text classification or NLP models
- Convert web scraping results to plain text for downstream text processing
- Remove boilerplate (styles, scripts) while preserving document structure via newlines
- Build text-only versions of web content for accessibility or archival
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to extract clean text from HTML with structure preservation.
Low install friction, permissive license, no known vulnerabilities, and stable API make it a safe choice. Maintenance is aging but the repository remains active; suitable for production use in text extraction pipelines.
Install
html-text on PyPI
Before you install
Low friction: pure Python wheel with only lxml and lxml-html-clean as runtime dependencies. Last release 312 days ago; repository is active and not archived, though maintenance status is aging.
Requires lxml, which has compiled C dependencies; installation may need a C compiler or pre-built wheels for your platform.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install html-text
import html_text
text = html_text.extract_text('<p>Hello</p><p>world</p>')
print(text)
Verify before relying
- Whether parsel is an optional dependency or required for selector_to_text functionality
- Performance characteristics on large HTML documents or batch processing scenarios
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packageslxmllxml-html-clean |
| Maintenance | Aging 312 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,433,260 / month, #3,908 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: html_text-0.7.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “convert html to text”
- html-textExtracts plain text from HTML while filtering out styles, scripts,…
- html2textConverts HTML to clean, readable plain text or Markdown-formatted…
- markdown2Converts Markdown text to HTML using a fast, complete Python…
Give your agent the search over MCP, or paste the wish link into any chat.
More HTML packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
lxml provides Python bindings to libxml2 and libxslt, enabling parsing, validation, and transformation of XML and HTML documents through an ElementTree-compatible API with support for XPath, XSLT, and schema validation.
Install it if you need robust XML/HTML parsing, validation, or transformation; avoid it only if you must stay pure-Python and can accept slower performance.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
Converts Markdown text to HTML using a Python implementation of John Gruber's Markdown specification, with support for extensions.
Install it if you need to parse Markdown in Python.
See also jusText · paragraphs · w3lib · parsel · proces · html-sanitizer · boilerpy3 · pynliner · css-inline · antiword