JAVASCRIPT FORMATTER / PRETTIER

JavaScript Formatter

The same output as Prettier in VS Code, right in the browser.

Runs locally · code is not uploaded
Options

YOUR NEXT STEP

Connect useful tools with your company workflow

Create a company account to configure website monitoring, business email and notifications, and invite your team to work together.

New companies receive a 14-day Pro trial, with no card required. Trials exclude the paid monthly credit grant.

Already have an account? Open your workspace →

How to use it

  1. Paste code, drop a file or load the sample; the language is preset for this page and can be changed.
  2. Choose format or minify and adjust indent, width and other options; the result appears on the right as you type.
  3. Copy or download the result; on an error, use "Go to error", fix it and run again.

Code style options

Common conventions
OptionsRecommendation
Indent2 spaces (common in front end) / 4 spaces / tab
Line widthWrap at 80; 100 or 120 for wide screens
QuotesDouble (Prettier default) or single
SemicolonOn by default to avoid ASI surprises
Trailing commasAdded on multi-line lists for cleaner diffs

Languages and engines

Formatting uses the same open-source engines as popular editors, so results match Prettier in VS Code and your team can keep one style. Every engine loads from this site and runs in your browser.

Language
LanguageFormatCompress
HTMLPrettier 3✓ comments and whitespace
XMLXunL XML engine✓
CSS / SCSS / LessPrettier 3✓ CSSO restructuring
JavaScript / TypeScriptPrettier 3(Babel)✓ Terser (JavaScript only)
JSONPrettier 3✓ big numbers keep precision
YAMLPrettier 3— (comments kept)
SQLsql-formatter (14 dialects)—

Frequently asked questions

Can it un-minify JavaScript?

It restores indentation and line breaks so the code is readable again, but shortened variable names such as a, b and c cannot be recovered.

Does it support TypeScript and JSX?

Yes. Choose TypeScript for type annotations and interfaces; JSX works under JavaScript.

Is my code uploaded?

No. The engines download from this site and run in your browser; your code never passes through our servers or any third party, so it is safe for internal code and configuration.

How large can files be?

Up to 5 MB per file; above 300 KB the page waits for the button instead of formatting as you type, to keep the browser responsive.

JavaScript formatter practical guide and common questions

What does a JavaScript formatter do?

Prettier 3 (Babel parser) reprints the code: wrapping at the line width and unifying quotes, semicolons and trailing commas; TypeScript uses babel-ts and JSX works directly.

Who is this for, and when is it useful?

Front-end developers, script-writing marketers and engineers inspecting third-party code who need to read minified JS or keep one team style.

How do I use this JavaScript formatter?

Paste JavaScript, JSX or TypeScript and Prettier formats it with your indent, width, quote, semicolon and trailing comma settings, pointing syntax errors to line and column.

How should I interpret the results?

Prettier reflows the whole file, keeping comments but not your original line breaks; shortened variable names cannot be restored.

Where is the work performed, and which services receive data?

JavaScript is parsed and reprinted, never executed or uploaded.