Code Formatter

Current language: JavaScript
Input code
Formatted output
Formatted code will appear here.

About Code Formatter

A local browser workbench for Prettier code formatting

The online code formatter helps normalize source code before committing, sharing, or pasting it into another tool. It runs Prettier in the browser for common web, config, document, and data languages, supports auto detection and manual language selection, and remembers indentation, quote, semicolon, trailing comma, and wrapping preferences without uploading code.


Features

  • Auto-detects common code languages with manual override
  • Runs Prettier standalone locally in the browser
  • Shows original input and formatted output side by side
  • Supports indentation, semicolons, quotes, trailing commas, and print width
  • Saves preferences and includes a restore-defaults action

How to use

  1. 1Paste code or upload a local code file
  2. 2Review the detected language and switch manually when needed
  3. 3Adjust common options or open advanced settings
  4. 4Format and review the output panel
  5. 5Copy, download, or replace the input with the formatted result

FAQ

Is my code uploaded to a server?
No. Formatting runs locally in your browser, so the input code does not leave your device.
Which languages are supported?
This tool supports browser-compatible Prettier languages including JavaScript, TypeScript, JSON, HTML, CSS, SCSS, Less, Markdown, MDX, YAML, GraphQL, Vue.
How does automatic detection work?
The tool checks the file extension first, then uses code heuristics to pick a likely language.
Can formatting preferences be saved?
Yes. Language mode, selected language, and formatting options are saved in localStorage for this browser.
Does restoring defaults clear my code?
No. Restore defaults resets language mode and formatting options while keeping the current input.

Related Tools

Online CalculatorFile Type DetectorAudio EditorPDF MergePDF CompressorPassword GeneratorWord CounterText CompareTimestamp ConverterUnicode ConverterFull Screen Text DisplayBase ConverterBase64 Encoder DecoderURL Encoder DecoderHTML Entity EscapeMD5 EncoderJWT Decode Verify EncodeQR Code Generator & DecoderBarcode GeneratorReal Address GeneratorBMI CalculatorUUID Generator & ParserCountry CapitalsRegex TesterHTTP Status Codes