HTML Formatter

Indent and tidy HTML so nested tags are easy to read, or minify it to remove comments and extra whitespace — right in your browser.

Suggested tools

HTML Minify

Remove comments and extra whitespace from HTML safely.

HTML
Open Tool

CSS Formatter

Beautify minified CSS into readable rules, or minify it.

CSS
Open Tool

JavaScript Beautifier

Make minified JavaScript readable with clean indentation.

JavaScript
Open Tool

HTML Escape / Unescape

Encode < > & " ' as HTML entities, or decode entities back to text.

HTML
Open Tool

HTML to Markdown

Convert HTML into Markdown instantly.

HTMLMD
Open Tool

Markdown to HTML

Convert Markdown into HTML instantly.

MDHTML
Open Tool

About HTML Formatter

HTML Formatter re-indents HTML so the structure of nested elements is easy to see, with each block element on its own line and two-space indentation. Use it on minified pages, generated email templates, CMS output or markup copied from browser dev tools.

Minify, on the same page, does the reverse: it removes comments and collapses extra whitespace while leaving <pre>, <textarea>, <script> and <style> content untouched. Everything runs locally in your browser — the text you paste is never uploaded.

How to use HTML Formatter

  1. Paste your HTML or upload an .html file.
  2. Press Beautify to format it, or Minify to compress it.
  3. Copy or download the result.

Key features

  • Beautify and Minify in one place
  • Formatting by the js-beautify library
  • Inline <script> and <style> blocks handled
  • No line wrapping, so long lines are never broken mid-text

Example

Input
<ul><li><a href="/">Home</a></li><li><a href="/tools">Tools</a></li></ul>
Output
<ul>
  <li><a href="/">Home</a></li>
  <li><a href="/tools">Tools</a></li>
</ul>

When to use HTML Formatter

  • Reading minified HTML from a website's page source.
  • Tidying HTML exported from email builders or page editors.
  • Indenting templates before editing them by hand.

Tips and common problems

  • Formatting does not fix unclosed tags — validate the structure if layout looks wrong.
  • Text inside <pre> is whitespace-sensitive; check those blocks after formatting.
  • Use Minify only on the copy you publish.

Frequently asked questions

Indentation between block elements does not affect rendering. Inside inline content, whitespace can matter slightly, so check pages that rely on exact spacing.