
HTML Formatter — Beautify and Minify HTML Online Free
Format HTML with consistent indentation or minify it to one line in your browser.
Paste your HTML here…
or drop an .html file — get clean indented markup to copy or download
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
2 settings
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
Related tools for HTML Prettify
Tools for common next steps after HTML Prettify.
Developer Tools
JSON Prettify
Validate JSON, format it with 2, 4 or 8 spaces, or minify it in your browser.
Try it nowText & Writing Tools
Markdown Editor
Write or open a .md file, review the HTML preview and export as HTML or Markdown. Editing stays in your browser.
Try it nowDeveloper Tools
Diff Checker
Compare two texts in split or unified view with additions and deletions highlighted; no account is required.
Try it nowFrequently Asked Questions
Paste any HTML — even single-line minified output from a build pipeline — and the tool reformats it with proper indentation, one tag per line and consistent whitespace. Choose 2, 4 or 8-space indent. The output is ready to drop into your editor or paste into a code review comment.
usagePrettify expands HTML for readability: each tag on its own line, nested children indented, blank lines preserved between sections. Minify strips comments, collapses runs of whitespace and removes line breaks so the file ships in fewer bytes. Use prettify for editing and review, minify for production deployment.
featuresNo — the formatter detects script and style blocks and formats their contents with the appropriate JS or CSS rules, so inline scripts stay valid and stylesheets stay readable. Self-closing tags, void elements, and namespaced attributes (svg:xmlns, xlink:href) are all handled correctly.
technicalIt handles plain HTML and HTML-like templates well, but pure JSX (curly-brace expressions, fragments, capitalised component tags) is parsed as HTML and may pick up minor cosmetic issues. For framework-specific code we recommend Prettier configured for your dialect; for raw HTML, .htm, and template files our tool is perfect.
featuresNo upload happens. The formatter runs entirely in your browser, so you can safely paste internal page templates, draft emails, or HTML containing private data without anything leaving your device.
privacyMinify strips HTML comments, collapses any run of whitespace between tags to a single space, and removes line breaks. The result is byte-identical-rendering HTML that is typically 10-30% smaller. Combined with gzip on the server, this shrinks initial page weight noticeably on content-heavy pages.
technicalYes — click Download to save the prettified output as output.html or the minified output as output.min.html. The file is UTF-8 encoded, so it works equally well with English, Cyrillic, CJK and right-to-left content.
tipsIt is a small browser-only utility — zero hosting cost — so we ship it free as part of our developer toolkit. No ads, no tracking on the output, no limits on file size beyond what your browser can hold in memory.
pricingPrettify mode lets you pick 2, 4 or 8 spaces of indentation. Pick the width your editor or code style uses, then copy the result or download it as output.html so the formatting carries straight into your project.
featuresThe indent selector (2, 4 or 8 spaces) only applies in Prettify mode, since Minify strips all whitespace and line breaks by design — there is nothing left to indent. Switch back to Prettify to see the indent width take effect again.
featuresAs you paste or edit, the tool automatically runs a structural check and lists any unclosed, mismatched or stray closing tags directly under the output panel — no separate button needed. A green "No structural issues found" message confirms the markup is well-formed.
qualityUse Prettify mode with 2-space indent — it's the most common convention and keeps diffs compact — then check the structural-issues panel to confirm they haven't left an unclosed tag. Once reviewed, switch to Minify mode before shipping to production to strip the extra whitespace back out.
tipsYes — drag an .html, .htm or .xhtml file onto the upload area, or click it to browse, and its contents load straight into the input box exactly as if you'd pasted them. From there, Prettify, Minify, indent width and the structural checker all work identically whether the markup came from a file or a paste.
usageYes — once there's output, a Copy button appears next to the output panel and the primary action area. Clicking it copies the current Prettify or Minify result to your clipboard instantly (it briefly shows 'Copied!' for confirmation), so you can paste directly into your editor or a code review comment without saving an intermediate .html file.
featuresNo — HTML Prettify runs entirely in your browser, so what you paste never leaves the machine you are on. That matters if you are checking something that contains a token, a key or customer data. Closing the tab is enough to clear it.
troubleshootingThe error points at the first position that could not be parsed, which is usually just after the real mistake rather than on it — a missing comma, an unclosed quote or bracket, or a smart quote pasted in from a document instead of a straight one. Check the line above the reported position first.
troubleshootingNo to both. HTML Prettify is free, your download carries no watermark, and nothing is asked for at the end — there is no point in the flow where you finish the work and then discover it costs money.
pricingNo — HTML Prettify runs in the browser on desktop and phone. There is nothing to install, no trial to start, and no license to buy before you can see whether it does what you need. Try it on the file you are actually stuck with rather than a sample.
troubleshootingHow 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.


























