Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
82 lines (60 sloc) 2.41 KB


An HTML Minifier with Seatbelts

.. toctree::


htmlmin is an HTML minifier that just works. It comes with safe defaults and an easily configurable set options. It can turn this:

    <title>  Hello, World!  </title>
    <p> How are <em>you</em> doing?  </p>

Into this:

<html><head><title>Hello, World!</title><body><p> How are <em>you</em> doing? </p></body></html>

When we say that htmlmin has 'seatbelts', what we mean is that it comes with features that you can use to safely minify beyond the defaults, but you have to put them in yourself. For instance, by default, htmlmin will never minimize the content between <pre>, <textarea>, <script>, and <style> tags. You can also explicitly tell it to not minify additional tags either globally by name or by adding the custom pre attribute to a tag in your HTML. htmlmin will remove the pre attributes as it parses your HTML automatically.

It also includes a command-line tool for easy invocation and integration with existing workflows.


To install via pip:

pip install htmlmin

Source Code

Source code is availble on github at

git clone git://


Indices and tables