Skip to content
UniKit

HTML formatter

Minify and pretty-print HTML from the same tag-level re-flow: raw-text element contents and comments are preserved so the size reduction is real.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

HTML source

Result

The result can be copied directly.

Enter HTML to see the formatted result

Characters: 0 · Lines: 0

What this tool does

  • Expand a single-line markup export into a readable structure.
  • Strip whitespace between tags before shipping.
  • Compare line counts to see how much volume is pure whitespace.

Example

Input

<div><p>x</p></div>

Output

<div>
  <p>
    x
  </p>
</div>

Raw-text elements (script/style/pre/textarea), CDATA and comments are preserved verbatim.

Frequently asked questions

Will content be changed?

No. Only whitespace between tags is re-flowed; text nodes, attribute values, CDATA and comments stay verbatim.

What about newlines inside attributes?

Quoted attribute values are not re-flowed, so multi-line values survive.

Are unclosed tags repaired?

No. The tool performs no semantic repair; unclosed tags stay as they are.

Why are there still newlines after minifying?

Newlines inside `<pre>` / `<script>` / `<style>` are content, so only whitespace between tags is collapsed.

Keywords:html formatterformatconverterdeveloper

Related tools