About Code Formatter
Format, minify and validate 46 languages in your browser.
What it does
Code Formatter is a single-page beautifier and validator for 46 languages — JSON, YAML, XML, HTML, CSS, JavaScript, TypeScript, Python, Go, Java, C/C++, C#, PHP, Dart, Lua, Shell, many SQL dialects and more. Paste code, pick a language (or let it auto-detect), and get clean, consistently indented output. Errors show the exact line and column.
How to use it
- Paste your code, drop a file, or open one from your device.
- Pick a language from the list, or leave it on Auto-detect.
- Choose 2 spaces, 4 spaces or tabs, then click Format (or Minify for JSON, XML and CSS).
- Copy the output, or use it as the new input. The Logs panel shows what happened.
Why I made this
Most free websites that convert a PDF or crunch your numbers do it on their own servers. Your files and data leave your device, and you have to trust that they're deleted afterwards. Very few of them can honestly promise zero data retention.
These are tools I actually need in my day-to-day work and life. Instead of uploading my stuff to a stranger's server every time, I built small versions that run entirely in the browser. Nothing to upload, nothing to retain.
I built them for personal use, but there's no reason to keep them to myself. If they're useful to me, they might be useful to you too — free, no sign-up, and your data stays with you.
Frequently asked questions
Is my code sent to a server?
No. All formatting runs in your browser using JavaScript and WebAssembly builds of well-known formatters. Your code never leaves your device.
Can it fix broken JSON?
Yes — JSON has an auto-fix for common mistakes like trailing commas and single quotes, plus a sort-keys option.
Which formatters does it use?
It uses open-source formatters such as Prettier, sql-formatter, clang-format, gofmt and Ruff, running in the browser.
Your privacy, in short
Code Formatter does its work in your browser. Your browser's local storage remembers your last language, your theme and whether you liked the tool. Your code is not stored. Read the full Privacy Policy.
Formatted output is provided as-is. Review changes before committing them to important projects.
Code Formatter is part of useful-indeed, a growing shelf of small, free web tools.