htmlmin
An HTML Minifier
What it is and what it does
htmlmin is a Python library that reduces HTML file size by removing unnecessary whitespace, comments, and other redundant markup while preserving the document's structure and functionality. It offers configurable options to control what gets minified, allowing you to balance file-size reduction against the risk of breaking layout or behavior.
The package has no runtime dependencies and installs from source only. However, it has been abandoned since late 2017 and receives no maintenance; the last commit was in 2021 but no releases followed. It was originally designed for Python 2.7 and 3.2, making its behavior on modern Python versions uncertain.
Use it for:
- Reduce HTML payload size in static site generators or build pipelines before deployment.
- Minify HTML templates in web applications to lower bandwidth costs and improve page load times.
- Strip comments and whitespace from generated HTML in automated testing or documentation workflows.
- Integrate HTML compression into CI/CD pipelines for front-end asset optimization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Minifies HTML by removing unnecessary whitespace and comments while preserving functionality, with configurable safety options to prevent breaking changes.
No. The package is abandoned (last release 2017-12-29, last commit 2021-10-20) with no maintenance or compatibility updates. High install friction (source-only distribution) and unverified Python compatibility compound the risk. For modern HTML minification, choose an actively maintained alternative.
Install
htmlmin on PyPI
pip
pip install htmlminuv
uv add htmlminpoetry
poetry add htmlminInstalling htmlmin
Before you install
High install friction due to source distribution only. Package is abandoned—last release was 2017-12-29 and last commit 2021-10-20—so expect no maintenance, bug fixes, or compatibility updates.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions; you may use and modify freely provided you retain the license notice.
Quickstart
pip install htmlmin
import htmlmin
minified = htmlmin.minify('<html> <body> Hello </body> </html>')
Package classifiers indicate Python 2.7 and 3.2 support; compatibility with modern Python versions is unverified and likely broken given abandonment since 2017.
Verify before relying
- Whether htmlmin works correctly with modern Python versions, given the last release predates current standards by years.
- What specific 'safety features' the minifier provides and how they differ from other HTML minifiers.
- Whether the package handles modern HTML5 constructs and attributes correctly.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,150 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 985,273/month — #4,575 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: htmlmin-0.1.12.tar.gz
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
htmlmin2Minifies HTML by removing unnecessary…
permissive · top 5,000 on PyPI
jsminMinifies JavaScript code by removing…
permissive · top 5,000 on PyPI
django-htmlminMinifies HTML by removing whitespace and…
permissive · top 5,000 on PyPI
JSON_minifyMinifies JSON by removing whitespace and…
permissive · top 15,000 on PyPI
rjsminrjsmin minifies JavaScript code by removing…
permissive · top 5,000 on PyPI
csscompressorCompresses CSS by removing unnecessary…
permissive · top 5,000 on PyPI
rcssminRCSSmin minifies CSS by removing spaces,…
permissive · top 5,000 on PyPI
mkdocs-minify-pluginMinifies HTML, JavaScript, and CSS files in…
permissive · top 5,000 on PyPI
cssminCompresses CSS files by removing unnecessary…
unclear · top 15,000 on PyPI
css-html-js-minifyMinifies CSS, HTML, and JavaScript files or…
copyleft · top 15,000 on PyPI