HTML, CSS & JavaScript Formatter

Paste your code — the language is detected for you. Format adds indentation; Minify strips what isn't needed.

Your code stays in the browser and is never uploaded.

How to use

Paste the code and press a button. The language is guessed from the content, but you can set it by hand if a short snippet is read wrongly. Below the result you can see how the size changed.

Formatting helps when code arrives as one long line from someone else's project or a minified file and you need to read it. Minifying is the opposite job: fewer bytes before you ship, which means a faster page.

FAQ

Why does JavaScript shrink less than CSS?

Real JavaScript minification needs a full parse into a syntax tree; without one it is easy to break automatic semicolon insertion or mistake a regular expression for a division. We took the safe route — comments and indentation go, line breaks stay. The file gets noticeably smaller and is guaranteed to still run.

Will minified code break my site?

No. For CSS and HTML the transformation preserves meaning, and for JavaScript the conservative mode is deliberate. Still, test the result before shipping, as with any automated change to code.

What happens to script and style blocks inside HTML?

They are left alone. The contents of script, style, pre and textarea are carried through unchanged, because a line break inside them can change the meaning.

Is my code sent anywhere?

No, everything runs in the browser. You can safely paste production code.

More tools