Skip to content

JavaScript Formatter

Runs in your browser

Untangle minified or messy scripts, or minify them with Terser so they still behave the same. Working on CSS? Switch to the CSS Formatter.

Input

Output

Formatting…

How this one works

Beautify re-indents JavaScript, puts statements on their own lines and adds spacing around operators — ideal for reading a minified bundle or a one-line snippet from a log. It doesn’t rename anything, so the code is exactly as it was, just readable.

Minify uses Terser, the same minifier most build tools use. It removes comments and whitespace, shortens local variable names and simplifies expressions, while keeping behaviour the same. Terser is only loaded the first time you switch to Minify.

Questions

Can this restore original variable names in minified code?

No — once a minifier has renamed variables, the original names are gone from the file. Beautify makes the structure readable again; if you need the real names, look for the project’s source map.

Why not just strip the whitespace to minify?

Because JavaScript inserts semicolons at line breaks in some cases, removing newlines naively can change what the code does. Terser parses the code first, so the result is guaranteed to be valid and equivalent.

Is my code uploaded?

No. Both beautifying and minifying run in your browser. Nothing is sent to a server, and the code isn’t saved anywhere once you close the tab.

Keyboard shortcuts

Global

  • Show this shortcuts dialogShift?
  • Toggle light / dark themeCtrlShiftL
  • Close dialogsEsc

Formatter & Validator

  • Format JSONCtrlEnter
  • Minify JSONCtrlShiftM
  • Copy outputCtrlShiftC
  • Download output as .jsonCtrlShiftS
  • Clear input and outputCtrlShiftX

Tree Viewer

  • Focus the search box/
  • Expand all nodesCtrlShiftE
  • Collapse all nodesCtrlShiftR

Diff

  • Swap document A and BCtrlShiftS

Time & date tools

  • Use the current time (Epoch Converter)CtrlEnter
  • Copy the main resultCtrlShiftC
  • Clear the inputCtrlShiftX

JSON tools

JSON FormatterPretty-print or minify
JSON ValidatorCheck strict JSON validity
JSON Tree ViewerBrowse JSON as a tree
JSON DiffCompare two documents
JSON Path FinderExplore JSONPath expressions
JSON → CSVFlatten JSON into rows
CSV → JSONTurn rows back into objects

JWT tools

JWT DecoderRead header, payload, claims
JWT VerifierCheck an HMAC signature
JWT Expiry Checkeriat, nbf and exp in local time
JWT GeneratorBuild a signed test token
Base64URL EncoderEncode or decode a segment

Time & date tools

Epoch ConverterTimestamps to real dates
Cron Expression ExplainerCron in plain English
Time Zone ConverterOne moment, many cities
Duration CalculatorDate maths and durations

Code formatters

SQL FormatterBeautify or minify SQL
HTML FormatterBeautify or minify HTML
CSS FormatterBeautify or minify CSS
JavaScript FormatterBeautify or minify JS
Markdown to HTMLConvert with a live preview

Pages

JSON toolsFormat, validate, compare and convert JSON.
JWT toolsDecode, verify and generate JSON Web Tokens.
Time & date toolsConvert timestamps, read cron, compare zones.
Code formattersBeautify and minify SQL, HTML, CSS and JavaScript.
HomePopular tools and categories
All categoriesBrowse tools by category
AboutWhat ToolJar is and why
PrivacyWhat is and is not collected

Theme

Switch to light theme
Switch to dark theme