HTML / CSS / JS Formatter & Minifier

Format or minify HTML, CSS, JavaScript and JSON. Formatting uses prettier; minifying strips comments and redundant whitespace, with the size change shown live.

Indent
Line width
prettier · 内置压缩

Result

The result will appear here

Formatting runs the browser build of prettier and loads only the plugin for the selected language, so the first click is slower. HTML/CSS minifying is a conservative home-grown pass; JavaScript goes through terser.

CSS/HTML minifying is lossless only: no rule merging, no colour rewriting, no property reordering. Those need a full AST and one wrong move breaks the whole stylesheet.

JavaScript minifying does not mangle identifiers by default: after mangling every variable is called a, b, c and the output is unreadable. Chain your own step if you need it.

Whitespace between inline elements is removed too, which can glue adjacent words together. Only use it when no inline layout depends on it.

Comments

Sign in to join the discussion

No comments yet — be the first to say something