Free online HTML formatter supporting beautify and minify, with adjustable indent size and options to keep comments and blank lines.
TL;DR: Free online HTML formatter supporting beautify and minify, adjustable indent, keep comments and blank lines. Safely preserves script/style/pre content, runs locally in your browser.
This tool runs entirely in your browser. Open DevTools → Network panel and search your input — it appears in no request.
FAQ
Completely free, no registration required. Beautify and minify HTML directly in your browser — all operations run locally with no usage limits.
Two modes are supported: beautify and minify. You can choose 2/4/8-space indentation and toggle whether to keep comments and blank lines.
Yes. Contents inside script, style, pre, textarea, and code tags are preserved verbatim — they are never incorrectly minified or reflowed.
No. All HTML parsing and formatting runs locally in your browser. Nothing is uploaded to any server, ensuring your data stays private.
Related Tools
Related Articles
Online Code Formatter: Beautify JavaScript, HTML, CSS Code Instantly
Learn how to use an online code formatter to beautify JavaScript, HTML, and CSS. Understand Prettier formatting principles, configuration options, and team code style best practices.
Unexpected token '<' is not valid JSON — 5 Reasons Your API Returned HTML Instead
fetch throws SyntaxError: Unexpected token '<' when the response body is HTML, not JSON. Covers the 5 root causes: SPA history fallback returning index.html, auth 302 redirects, gateway 502 error pages, wrong baseURL, and missing res.ok checks — with curl diagnostics.
HTML Table to JSON: How to Preserve Rows, Columns and Structure
Converting an HTML table from a web page to JSON — how to keep headers, handle merged cells and nested structure? Step-by-step with our HTML table to JSON tool.