HTML Prettify & Minify - Format HTML Online Free
Beautify messy HTML with proper indentation, or minify to one line. Drop an .html file or paste, then copy or download the cleaned markup.
Input HTML
Formatted Output
About HTML Prettify
Powered by js-beautify, runs entirely in your browser. Prettify mode reformats tags onto their own lines with consistent indentation; Minify mode strips comments and collapses whitespace for the smallest payload.
Continue Enhancing Your Images
Take your photo editing to the next level with these popular tools
Add Text to Image
Add captions and titles to your enhanced photo
Add Photo Border
Frame your effect with beautiful borders
Compress Image
Optimize your enhanced image for sharing
Resize Image
Change image dimensions
Photo to Cartoon
Try a different artistic style
Pencil Sketch
Create artistic pencil drawings
Frequently 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 — js-beautify (the engine under the hood) 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 with js-beautify, 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.
pricingUse Cases
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.
Pixoate