JavaScript formatter

Make JavaScript readable and consistent, with your preferred style.

JavaScript formatter: illustration of a code editor with brackets, a colour swatch and a settings gear
JavaScript formatter is part of our free Developer tools collection. It works in your browser on phones, tablets and computers, with no sign-up.

How to use the JavaScript formatter

  1. Paste JavaScript or TypeScript, or choose a file.
  2. Pick indent size, quotes and semicolons.
  3. Press Format and copy or download.

When it's useful

  • Reading minified or one-line scripts
  • Making code style consistent before review
  • Spotting syntax errors

Limits to know

  • Formatting only — it doesn't minify, run or check the logic of your code.

Your privacy

Everything is worked out in your browser. What you type isn't uploaded, saved or shared, and there's no sign-up.

What goes in and what comes out

Input:
JavaScript or TypeScript pasted or as a file, up to 5 MB.
Output:
Formatted code, copyable or as a download.

Questions

Does it run my code?

No. It only reads and re-prints it.

Related tools