HTML Formatter & Minifier - Format or Minify HTML Online
Format or minify HTML
Paste a full document or a fragment and choose Format or Minify. Format indents each element by its nesting depth. Void
elements such as <br>, <img> and <input> do not expect a closing
tag, so they do not throw the indentation off. The contents of <pre>, <textarea>,
<script> and <style> are left exactly as they were in both modes.
Minify without breaking spacing
Minify removes comments and collapses runs of whitespace to a single space. It only drops a space entirely when a
block-level tag is next to it, because the space in Hello <b>world</b> is visible on the page.
<div>\n <p>a b</p>\n</div> becomes <div><p>a b</p></div>.
Limits
The formatter puts every tag on its own line, inline tags included, so <p>Hi <b>there</b></p>
is split over several lines. That is fine for reading but can add visible spaces inside inline elements, so check the result
before pasting formatted markup back into a page. Attributes are not reordered or re-quoted. To turn markup into React code,
use HTML to JSX.
Related Tools
Epoch / Unix Timestamp Converter
Convert between Unix epoch timestamps and human-readable dates.
Regex Tester
Test regular expressions against text with match highlighting.
UUID Generator
Generate random v4 UUIDs for use in databases and APIs.
Colour Converter
Convert colours between HEX, RGB, and HSL formats.