JSON Parser

HTML Formatter & Minifier Online

Beautify messy HTML with proper indentation, or minify it by removing comments and the whitespace between tags. Content inside <pre>, <textarea>, <script> and <style> is left untouched. Everything runs in your browser.

How to format or minify HTML

  1. Paste your HTML into the Input box.
  2. Choose Beautify for readable output or Minify for the smallest output. The result updates as you type.
  3. Click Copy to copy it. In Minify mode the badge shows how much smaller the output is.

Example

Input HTML

<!DOCTYPE html>
<html lang="en"><head><title>Hello</title></head>
<body><!-- main -->
<div class="container"><h1>Hello, world</h1><p>A <strong>sample</strong> page.</p>
<ul><li>One</li><li>Two</li></ul></div></body></html>

Beautified

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Hello</title>
</head>

<body><!-- main -->
  <div class="container">
    <h1>Hello, world</h1>
    <p>A <strong>sample</strong> page.</p>
    <ul>
      <li>One</li>
      <li>Two</li>
    </ul>
  </div>
</body>

</html>

Same input

<!DOCTYPE html>
<html lang="en"><head><title>Hello</title></head>
<body><!-- main -->
<div class="container"><h1>Hello, world</h1><p>A <strong>sample</strong> page.</p>
<ul><li>One</li><li>Two</li></ul></div></body></html>

Minified

<!DOCTYPE html><html lang="en"><head><title>Hello</title></head><body><div class="container"><h1>Hello, world</h1><p>A <strong>sample</strong> page.</p><ul><li>One</li><li>Two</li></ul></div></body></html>

Tips

  • Beautify indents by nesting depth and wraps long lines.
  • Minify removes comments and whitespace between tags; test the result, since removing whitespace between inline elements can change spacing.
  • Choose 2 spaces, 4 spaces or tabs for beautified output.

Related tools

Escape special characters with HTML Entities, preview formatted text with the Markdown preview, or minify CSS and JavaScript.

Frequently asked questions

How do I format HTML online?
Paste your HTML and choose Beautify. Tags are indented by nesting depth and long lines are wrapped, making minified or copy-pasted markup easy to read.
How does the HTML minifier work?
Minify removes comments and the whitespace between tags. Content inside <pre>, <textarea>, <script> and <style> is left untouched so behaviour doesn't change.
Will it change how my page renders?
Beautifying only changes whitespace. Minifying can remove whitespace between inline elements, which in rare cases changes spacing, so test the result. Everything runs in your browser — your code is never uploaded to a server.
Handles JSON files up to 20MB smoothly