Web & Developer Utilities100% Client-Side

HTML Minifier

Use the HTML Minifier to make a readable markup snippet more compact for a fixture, example, or transfer field. It removes HTML comments, closes gaps between tags, and reduces repeated whitespace. The result is easy to copy as a string. Since some HTML depends on spaces, especially near inline tags or inside preformatted sections, preview the compact version before substituting it for a page or template that is already in use.

Input
87 chars•5 lines
Output

Reverse tool

HTML Prettifier

Format compact HTML with two- or four-space indentation. See tag nesting at a glance and prepare readable snippets for code reviews, tests, or documentation.

Open HTML Prettifier

How to Use the HTML Minifier Online

  1. 1Paste a copy of the source markup. Keep the readable version nearby if you need to compare the result with the original document or template.
  2. 2Look through the compact output for spaces that carry meaning, such as the gap between two inline elements in a sentence.
  3. 3Check whether the original contains comments used by a build step, template engine, or integration. Keep any required markers in the source version.
  4. 4Copy or download the result after testing how the destination renders it. For a short fixture, compare the expected text and the element structure.

Input & Output Examples

The comment and line breaks between the tags are removed. The link and its href stay in the output.

Input Sample
<nav>
  <!-- primary links -->
  <a href="/docs">Docs</a>
</nav>
Expected Output
<nav><a href="/docs">Docs</a></nav>

Runs of spaces inside the first text node become one space, and the gap between the two elements is removed.

Input Sample
<div>Plan     details</div>

<div>Updated today</div>
Expected Output
<div>Plan details</div><div>Updated today</div>

Practical Developer Workflows

  • Prepare a compact markup fixture for a test that compares serialized HTML from a simple template.
  • Remove editorial comments from a short example before including the markup in a plain-text support message.
  • Compare a compact version of a simple static snippet with its readable source when reviewing how much whitespace it contains.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

It removes text enclosed by standard HTML comment delimiters. Some frameworks and templates use comments as markers for their own processing. Check the source and retain the original when a comment could be part of the integration contract.

Explore Other Tools

12 suggested tools

View all tools