All tools

HTML Prettify

HTML Formatter — Beautify and Minify HTML Online Free

Format HTML with consistent indentation or minify it to one line in your browser.

Upload HTML file

Input HTML
Formatted Output

How to beautify or minify HTML online and spot unclosed tags

This HTML formatter turns minified or messy markup into clean, indented HTML, or squeezes it into compact markup. Paste code or open an .html file, choose Prettify or Minify, pick an indent of 2, 4 or 8 spaces, and the result appears below with a structure check that lists unclosed and stray tags. The formatting runs in your browser, and nothing needs installing.

Beautify minified HTML with the indent you prefer

Prettify is the default mode. Nested elements are indented by the width you choose under Indent, long lines are not wrapped, and existing blank lines are kept down to one. Style and script blocks are indented as CSS and JavaScript, and the contents of pre and textarea elements are left as written. Copy puts the result on your clipboard and Download .html saves Pixoate_output.html. Try sample loads a one-line page so you can see the layout first.

  1. Paste your HTML into Input HTML, or open an .html file.
  2. Leave Mode on Prettify.
  3. Choose 2, 4 or 8 spaces under Indent.
  4. Select Copy or Download .html.

Minify HTML to reduce its size

Minify removes comments, takes out the whitespace between tags and collapses each run of two or more spaces or line breaks to one space, then Download .html saves Pixoate_output.min.html. It is a simple whitespace pass, so check the result. The space between two inline elements disappears, so a bold word and an italic word run together. Indentation inside pre blocks and textareas is flattened, and an indented line comment in an inline script can comment out the code after it.

Check HTML for unclosed or mismatched tags

Under the output, a green line says No structural issues found, or Structural issues lists up to eight problems such as Unclosed tag <div> or Unexpected closing tag </span>. The check keeps a stack of open tags and ignores comments and the insides of script and style. It is not a full HTML validator and it does not repair markup: it does not check attributes or nesting rules, a missing end tag stays missing in the output, and it reports li and p elements whose closing tags were left out on purpose, which browsers accept.

Format a file, template or snippet

Open .html, .htm and .xhtml files from the upload strip; files over 5 MB are refused, and pasting is the alternative. Plain markup is the target, so curly-brace template syntax may be indented oddly. To produce HTML from notes first, write and preview Markdown, and to confirm that a format run changed only whitespace, compare the two versions. JSON placed in a script tag can be tidied with the JSON formatter.

Before you ship formatted or minified HTML

  • Minify only the copy you publish, and keep the readable source.
  • Open the minified page and check inline spacing, code blocks and scripts.
  • Treat the structure check as a hint, not as a validator.
  • Compare the formatted file with the original to confirm only whitespace changed.

To review an edit, paste the old and new markup side by side and see each added or removed line; an href with spaces or accented characters needs percent-encoding before it goes in the attribute. Empty templates are easier to judge with lorem ipsum already wrapped in paragraph tags, and content you would rather write than hand-code fits a Markdown editor that exports HTML.

What you can do with HTML Prettify

Review the main capabilities before you begin.

  • Beautify messy HTML with proper indentation
  • Minify HTML down to a single line
  • Clean up pasted or copied markup fast
  • Choose your preferred indent size
  • Copy or download the tidied HTML

Settings reference

Available controls for HTML Prettify.

Settings

ModePresets
Choose Prettify to reformat messy HTML with clean line breaks and indentation, or Minify to strip comments and collapse whitespace so the markup fits on one compact line.Options: PrettifyMinify
IndentDropdown
Sets how many spaces each nested tag is indented in Prettify mode; 2 spaces is the common convention, while wider indents make deeply nested markup easier to scan.Options: 2 spaces4 spaces8 spaces
Free to use · No signup required · Without watermarkUploads are encrypted in transitRemoved under our retention policy

Frequently Asked Questions

How HTML Prettify helps you get it done

Real problems it solves every day — for businesses, creators, and everyday tasks. Find the use case that fits you and start.

Marketing

Email Template Cleanup

Marketing email HTML often arrives from ESPs as a single minified blob. Beautify it to inspect the structure, find that broken table column, and patch a typo before sending the next blast.

For Developers

CMS Content Migration

Exporting from one CMS and importing into another usually involves moving HTML. Prettify makes diffs readable, minify shrinks the payload, and both modes preserve content fidelity.

For Developers

Web Scraping Output

Raw HTML scraped from a website is unreadable without formatting. Prettify the output to find the CSS selector you need, then write the extraction rule for your scraper.

Web & SEO

Static Site Optimisation

Minify generated HTML from your static site generator before deploying. Shaves 10-30% off the file size on top of gzip — measurable improvement to first-paint times on content-heavy pages.

Publishing

Documentation Snippets

When pasting HTML examples into docs, blog posts or README files, beautify first so readers can follow the structure. Save the minified version for the "production output" comparison.

For Developers

JSX Refactoring Helper

Before converting a chunk of HTML to JSX, prettify it so the conversion script sees a clean tree. Saves manual reformatting in your React/Vue migration.

For Developers

Debugging Broken Page Layouts

Paste a suspect page's HTML and let the built-in structural checker flag unclosed or mismatched tags instantly — often the real cause of a layout that 'just breaks' in one browser, without hunting through raw view-source.

Education

Teaching & Learning HTML Structure

Students and bootcamp learners paste dense HTML from tutorials or CodePen and prettify it with 2-space indent to see the actual nesting hierarchy, making it far easier to follow than a wall of unindented markup.

Career & HR

Client-Ready Code Handoff

Freelancers and agencies prettify the final HTML deliverable before sending it to a client's in-house dev team, so the codebase looks professional and readable on first open — no extra billable hours spent just reformatting.

Research

Competitor Page & SEO Markup Audits

Paste a competitor's raw page source and prettify it, then quickly scan the readable output for heading structure, schema.org JSON-LD placement and meta tag patterns worth borrowing for your own SEO strategy.

Watch each transformation land

Every photo crosses the slash untouched and comes out the other side finished.