HTML Formatter
Auto-indent and organize HTML markup for better readability.
Minify JavaScript to reduce file size for faster page delivery.
Removes JS comments and redundant whitespace. Basic minification only — variables are not renamed. Everything runs locally.
Minifying does exactly three things: drop comments, collapse whitespace, remove spaces around punctuation. It does **not** rename identifiers, drop dead code or touch string contents — so the size win is modest and behaviour is unchanged.
It scans character by character instead of running regex replacements, so `//` and `/* */` inside strings, regex literals and templates survive (fixed 2026-09-20: `"/* x */"` used to be emptied, `/\/\//` truncated and `a + +b` joined into `a++b`).
The reverse direction uses js-beautify, downloaded **only when you actually switch to Format** — opening the page starts the minify path alone.
Paste JavaScript
The sample is a commented function; the minified result updates live.
Press Minify
Comments and redundant whitespace go, leaving one line.
Switch to Format when you want layout
The first switch downloads the beautifier on demand, then it is instant.
Modestly: no renaming, no dead-code elimination, no string rewriting, so a typical script shrinks by roughly 10–30%. A real minifier such as terser gets far further, at the cost of a full parser and slower runs. This one optimises for not breaking your code.
Yes, run it once. The main corruption paths are fixed (strings, regexes, templates, unary operators), but this is a scanner rather than a full lexer: regex-versus-division is a heuristic, and `case` statements or ASI-sensitive line breaks can still be affected. Conventional formatting is the safest input.
Auto-indent and organize HTML markup for better readability.
Minify HTML by removing extra spaces and non-essential characters.
Minify or prettify CSS code for production and maintenance workflows.
Beautify JavaScript code with consistent indentation and spacing.
Format, validate, and beautify JSON for easier reading and debugging.
Compress JSON by removing unnecessary whitespace and line breaks.
Sort JSON object keys alphabetically to keep structure consistent.
Format SQL queries to improve readability and team consistency.