WMW

JS/CSS Formatter

Free

Reformats minified or inconsistently indented JavaScript or CSS into readable, properly indented code, with adjustable indent style and before/after size stats.

Runs entirely in your browser. Your code is never uploaded anywhere.

Comments (0)

Found this tool useful? Leave a comment, share a tip, or tell us how we can make it better.

Guest comments are reviewed before publishing. Sign in to post instantly.

No comments yet. Be the first to share your thoughts!

What this tool does

Paste minified or messily indented JavaScript or CSS, choose an indentation style, and this tool reformats it into readable code with consistent indentation and line breaks.

How It Works

The tool parses your code into tokens (keywords, brackets, operators, strings), then re-prints those tokens with new line breaks and indentation based on nesting depth, using the open-source js-beautify engine for JavaScript and CSS respectively. The underlying tokens and their order are never changed, only the whitespace around them.

Problems it solves

Frequently asked questions

›Does this tool also minify code?

No, this tool only formats (beautifies) code by adding proper indentation and line breaks. If you need to shrink code size by removing whitespace, use a dedicated minifier tool instead.

›Will formatting change how my code behaves?

No. Formatting only changes whitespace, indentation, and line breaks. It never changes identifiers, logic, or string contents, so the formatted code behaves identically to the original.

›Why does my JavaScript look wrong after formatting?

If the input has a syntax error (an unclosed bracket, a stray comma, invalid JSON used as JS, and so on), the formatter may misread the structure. Check the browser console or a JavaScript linter for the exact syntax issue, fix it, and format again.

›Can I format SCSS or LESS with this?

Basic SCSS and LESS syntax (nesting, variables, comments) generally formats fine since it is still CSS-like, but preprocessor-specific features such as mixins or functions are not specifically understood and may be reformatted imperfectly.

›Why choose tabs vs. spaces for indentation?

It is purely a style preference, both are functionally identical in JavaScript and CSS. Pick whichever matches your project's existing style guide or editor configuration.

Related Tools