100% FREE  -  NO SIGN-UP  -  YOUR FILES NEVER LEAVE YOUR DEVICE

HTML Minifier

A careful HTML minifier that removes comments and collapses whitespace between tags, and leaves pre, textarea, script and style contents exactly as they are.

100% free, no premium plan No sign-up Files never leave your device
Drop your text here
or click to choose a file from your device

Your files are processed in your browser, on your own device. Nothing is uploaded to a server.

    An HTML Minifier shrinks a page by removing comments and whitespace the browser does not need. This one takes the careful route, costs nothing and runs in your browser with no upload. The contents of pre, textarea, script and style elements are never touched, and your attributes stay exactly as written.

    How the HTML Minifier works

    The minifier scans your markup in passes. It sets the protected blocks aside first, the pre, textarea, script and style sections whose spacing is real content. It then removes comments, folds the whitespace between tags down, and puts the protected blocks back word for word.

    1. Paste your HTML into the box, or drop an .html file onto the page.
    2. Run the minifier and read the output.
    3. Compare the shape of the result. The structure stays and the padding goes.
    4. Spot-check any place where spacing is content, such as a code sample inside a pre block.
    5. Copy the minified HTML, or download it as a file.

    Two kinds of comments survive on purpose. Conditional comments aimed at old browsers stay, and license comments stay, because both carry instructions or legal text that was never meant as padding.

    Where minified HTML pays off

    Hand-maintained static sites are the steady case. A landing page or a small site shipped as plain files picks up comments and blank lines with every edit, and nobody wants to strip them by hand before each deploy. Minify at ship time and the file that travels is the lean one, while your working copy stays readable.

    Pasted-in fields are the second case. Plenty of CMS screens, website builders and email platforms cap the size of an HTML field or simply handle shorter input more gracefully. A minified page fits where the padded one complains. The same goes for templates stored in a database field or a config value.

    The workflow pairs up neatly. Edit with the HTML Formatter open while the code needs to stay readable, then minify once at the end. The win from a safe minifier is a smaller file with zero surprises in the browser, and the CSS Minifier and the JS Minifier give the linked files the same treatment.

    HTML Minifier limits, stated plainly

    This minifier is conservative on purpose. Attributes are never rewritten and the quotes around attribute values are never removed. Aggressive minifiers strip quotes wherever the HTML spec allows it and save a few more bytes doing so. This tool leaves them in place, because one saved byte is not worth a page that breaks on an edge case in someone’s browser.

    Comments carry a real warning. Some setups hide working markers inside comments, from old server-side includes to markers that frameworks use while streaming a page. Conditional comments and license comments are kept here as a matter of policy, and ordinary notes are removed. If your stack leans on other comment markers to do its job, run the output once in a test before it ships.

    Keep the savings in perspective too. Gzip and Brotli compression already squeeze repeated whitespace well, so minification adds a modest slice on the wire rather than a dramatic one. The clearer wins are the raw file itself: smaller storage, shorter fields, and leaner markup when a page gets inlined into another file.

    Your pages stay on your device

    The minifier runs inside your browser tab. Your HTML is never sent to a ToolPeko server, never stored and never read by anyone here. Unreleased landing pages and client work get the same privacy as a test snippet, because the code path is identical. There is no account, no sign-up and no job counter. Paste a fragment or a full page and the terms stay the same.

    FAQs

    Will minifying break my page?

    The rules here are built to prevent exactly that. Protected blocks pass through untouched, attributes are never rewritten and quotes stay in place. Interactive pages still deserve one test run before the minified copy ships.

    Why are some comments still there after minifying?

    Conditional comments and license comments are kept on purpose. Conditional comments carry instructions for old browsers, and license comments carry legal text. Neither counts as padding.

    Does it minify the CSS and JavaScript inside the HTML?

    No. The contents of style and script blocks pass through exactly as written, spacing and all. Use the CSS Minifier and the JS Minifier for those files when they live on their own.

    Why not remove attribute quotes and save more space?

    The saving is a few bytes per tag, and the risk is a value with an unusual character breaking in the wild. Quotes stay, so every attribute value survives the trip exactly as written.

    How much smaller will my file get?

    That depends on how much comment and whitespace padding your source carries. A heavily commented working file shrinks a lot. A file that was already tight barely changes, and the output shows you the result either way.

    Is my HTML uploaded to a server?

    No upload happens. The minifier runs in your browser tab, and nothing is sent to or stored on a ToolPeko server.

    More Developer Tools

    Same rules as this one: free, in your browser, with nothing uploaded.

    Scroll to Top