Code Formatter

Paste messy or minified code and get it back cleanly indented — or shrink it for production. Fifteen languages, formatted by Prettier in your browser.

  • Prettier inside
  • Minify too
  • 15 languages
  • Code stays local

Options

Indentation

Longer lines are wrapped.

How it works

How to format code

Paste, read, copy.

  1. 1

    Paste your code or drop a file

    The language is detected automatically; you can also choose it from the list.

  2. 2

    Adjust the style

    Indentation, line width, quotes, semicolons and trailing commas — or the SQL dialect and keyword case.

  3. 3

    Copy or download

    Take the formatted result, or press Minify for the compact version.

Why ToolCMB

One formatter for the whole stack

The same engine many teams run in their editors.

Prettier quality

JavaScript, TypeScript, CSS, HTML, Markdown, YAML and GraphQL are formatted by Prettier, the de-facto standard formatter.

SQL for your database

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake and more, with keyword case of your choice.

Minify for production

Terser compresses JavaScript; CSS, HTML, JSON, XML and SQL are stripped of comments and needless whitespace.

Detects the language

Paste anything — the tool recognizes JSON, HTML, XML, CSS, SQL, TypeScript, JSX, YAML and more, or reads the file extension.

Clear error messages

Invalid code is not mangled: you get the line of the syntax error and one click selects it.

Off the main thread

Formatting runs in a background worker, so even large files do not freeze the page.

Private by design

Everything runs in your browser. What you type or open is not sent to a server.

Free, no sign-up

No account, no limits, no watermark — on a phone, tablet or computer.

Formatting, minifying and why both matter

Formatting (beautifying) rewrites code with consistent indentation, spacing and line breaks without changing what it does. It makes minified or auto-generated code readable, shows the real structure of deeply nested data, and ends style debates in code reviews: when a tool decides where the brackets go, diffs only show real changes.

Minifying is the opposite step for delivery: comments, whitespace and — for JavaScript — long variable names are removed so that fewer bytes travel to the browser. A typical script shrinks by 30–60 % before compression. Keep the readable source in version control and minify as part of the build; minified code is not meant to be edited.

This tool formats with Prettier, an opinionated formatter that parses the code into a syntax tree and prints it again from scratch. That is why it needs valid code: a missing bracket is reported with its line number instead of being guessed. The few options — line width, indentation, quotes, semicolons, trailing commas — match the ones in a .prettierrc file, so the output looks like your project’s.

Supported languages

LanguageFormatMinify
JavaScript, JSXYesJavaScript: yes (Terser)
TypeScript, TSXYesNo — compile to JavaScript first
JSONYesYes
CSS, SCSS, LessYesCSS: yes
HTML, Vue, XML, SVGYesHTML and XML: yes
SQL, Markdown, YAML, GraphQLYesSQL: yes

Tips

  • For JSON with tree view, validation and repair use the dedicated JSON Formatter.
  • Check a regular expression from your code in the Regex Tester.
  • Embed a small asset in CSS or HTML as a data URI with the Base64 Encoder.
  • Press Ctrl + Enter to format. The Tab key inserts an indent in the input field instead of leaving it.
FAQ

Frequently asked questions

Can’t find your answer? Contact us — we reply quickly.

Is my code uploaded to a server?

No. Prettier, Terser and the SQL formatter are downloaded to your browser and run there. Your code never leaves your device, so it is safe for proprietary source.

Why does formatting fail with a syntax error?

The formatter has to parse the code first. If a bracket, quote or tag is missing it cannot know what you meant, so it reports the line instead of producing wrong output. Fix that spot and format again.

Does formatting change how my code works?

No. Only whitespace, line breaks, quotes and optional punctuation such as semicolons or trailing commas change. The program’s behavior stays the same.

Is minified JavaScript safe to use?

Yes. Terser removes whitespace and comments and shortens local variable names without changing behavior. Switch off “Shorten variable names” if other scripts rely on names in the global scope.

Which SQL dialects are supported?

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark, DB2, Hive and Trino/Presto.

How large can the input be?

Files up to 5 MB can be opened. Live formatting pauses above 200,000 characters — press Format instead. Speed depends on your device, since all work happens there.

More free developer tools

Encode, format, test, convert and generate — small tools that run in your browser and keep your data on your device.

Browse all tools