HTML Formatter

Beautify or minify HTML, format inline CSS/JS, and preview the result.

Your HTML is beautified, minified, and previewed entirely in your browser — nothing is uploaded to a server.

Cleaning up stylesheets too? Try the CSS Formatter.

About HTML Formatter

This html formatter beautifies or minifies raw markup and formats any inline CSS and JavaScript automatically using Prettier. Paste messy template output, scraped pages, or hand-written markup and get clean, consistently indented HTML in one step, or switch to minify mode to strip whitespace and shrink the document for production. A sandboxed preview lets you render the markup safely with scripting disabled, so embedded scripts never execute. As an html beautifier and prettifier, it is built for front-end developers, QA engineers, and anyone who needs to format html online without context-switching. Everything runs locally in your browser, so your data never leaves your device. Choose tabs or spaces for indentation to match your project style.

Features

How to use the HTML Formatter

  1. Paste your HTML into the input box.
  2. Choose Beautify to format, Minify to compress, or Preview to render it.
  3. Toggle Tabs on or off to set your indentation style.
  4. Copy the formatted or minified HTML from the output panel.

Example

Input

<div   class="card"><h1>Hi</h1><p>Hello   world</p></div>

Output

<div class="card">
  <h1>Hi</h1>
  <p>Hello world</p>
</div>

Beautify mode reindents markup and normalizes whitespace.

Common errors & troubleshooting

Frequently asked questions

What is the HTML Formatter?
The HTML Formatter is an in-browser tool that beautifies or minifies HTML markup with Prettier, formats inline CSS and JavaScript, and previews the result in a sandboxed iframe.
How do I beautify minified HTML?
Paste your minified HTML into the input box and choose Beautify. The HTML Formatter reindents the markup and reformats any inline <style> and <script> blocks for readability.
Does the HTML Formatter format inline CSS and JavaScript?
Yes. Prettier formats <style> and <script> blocks automatically as part of beautifying the page.
Can I minify HTML as well as beautify it?
Yes. Switch to Minify mode to strip whitespace and produce the smallest equivalent markup for production.
Can I choose tabs instead of spaces?
Yes. Toggle the Tabs option in the HTML Formatter to indent with tabs, or leave it off to use spaces.
Is my HTML uploaded anywhere when I format it?
No. All formatting and preview rendering happen locally in your browser, so your markup never leaves your device.

Related tools

All ArrayKit tools