Zokilos

HTML Formatter & Beautifier

Pretty-print messy or minified HTML with proper indentation

Basic formatter — content inside <script>, <style>, <pre> and <textarea> is preserved as-is, not reformatted.

What Is This HTML Formatter?

A tool that takes messy, minified, or inconsistently indented HTML and re-indents it so the nesting structure is easy to read, without changing the markup itself.

How to Format Your HTML

1

Paste your HTML.

2

Pick an indentation style.

3

Click Format, then copy the result.

Indentation Options

Choose 2 spaces, 4 spaces, or a tab character from the dropdown. Changing it after formatting re-runs the format automatically with the new indentation applied.

What Gets Reformatted vs Preserved

Regular HTML tags, text, and comments get re-indented based on nesting depth. Content inside <script>, <style>, <pre>, and <textarea> is left exactly as written, since reformatting JavaScript, CSS, or pre-formatted text could silently change what it does or how it looks.

How Inline Elements Are Handled

Inline elements like <b>, <a>, or <span> get put on their own line, the same as block elements — so a short sentence with a bolded word or a link can turn into several lines of output. It looks more spread out than you might expect, but it doesn't change how the page renders, since HTML collapses whitespace between elements by default.

Is This the Same as Prettier?

No. Prettier fully parses the HTML and understands inline versus block-level elements, so it keeps inline markup compact on one line where it makes sense. This tool uses simpler tag-by-tag indentation and doesn't make that distinction, trading some polish for a much smaller, dependency-free implementation.

Formatting Minified or Messy HTML

Paste in a single-line minified page or HTML with inconsistent indentation from being edited by hand, and the formatter rebuilds consistent, nested indentation from scratch based on the actual tag structure — useful for reading through someone else's minified markup or debugging structure.

What This Tool Doesn't Do

  • No inline-vs-block-aware line wrapping like Prettier
  • No HTML validation or error checking, just re-indentation
  • No attribute reformatting or sorting
  • No minification — that's the separate Code Minifier tool

Limitations

  • Inline elements are exploded onto separate lines, more verbose than a parser-based formatter
  • Unclosed tags can throw off indentation for everything after them
  • No validation — invalid HTML is reformatted as-is, not flagged

Benefits of Using This Tool

  • Correctly preserves script, style, pre, and textarea content untouched
  • Choice of 2-space, 4-space, or tab indentation
  • Runs entirely in your browser — nothing uploaded to a server
  • Free, with no sign-up required

Frequently Asked Questions

Is this the same as Prettier?

No. Prettier fully parses HTML and understands inline versus block elements, so it can keep inline markup compact within a line. This tool does simpler tag-by-tag indentation and puts every element on its own line, inline or not.

Does it preserve script, style, pre, and textarea content?

Yes. Content inside those four elements is left exactly as written, not reformatted or re-indented, since reformatting JavaScript, CSS, or pre-formatted text could change what it means.

How does it handle inline elements like <b> or <a>?

The same as block elements: each one gets its own line. That makes the output more spread out than a formatter that understands inline flow, but it doesn't change how the page actually renders, since HTML collapses whitespace between elements by default.

What indentation options are available?

2 spaces, 4 spaces, or a tab character, selectable from the dropdown before formatting.

Does it handle malformed or unclosed HTML?

It won't error out — indentation depth is clamped so it can't go negative — but unclosed tags mean everything after them may be indented deeper than intended, since there's no closing tag to bring the depth back down.

Is my HTML sent to a server when I use this?

No. Formatting happens entirely in your browser using JavaScript. Nothing you paste here is uploaded anywhere.