Code Formatter

Beautify JSON, YAML, XML, HTML, CSS, JavaScript and TypeScript in one place. Pick a language, paste your code and get clean, consistently indented output.

Loading the Code Formatter…

How to use the Code Formatter

  1. Paste your code into the input panel, drop a file onto it, or load the sample.
  2. The formatted result appears on the right as you type. Change the indent size at any time.
  3. Copy the result or download it as a file. Press Ctrl/⌘ + Enter to format immediately.

Features

  • Seven languages: JSON, YAML, XML, HTML, CSS, JavaScript and TypeScript
  • Detects the language of pasted code automatically
  • Formats as you type
  • Copy, download and drag-and-drop file support
  • Remembers your last input on this device
  • Light and dark themes

Frequently asked questions

Which languages can I format?

JSON, YAML, XML, HTML, CSS, JavaScript (including JSX) and TypeScript (including TSX). Each also has a dedicated page, such as the JSON Formatter.

Does it work offline?

Yes. Once the page has loaded, formatting runs locally in your browser, so it keeps working without a network connection.

Is my data uploaded to a server?

No. Everything runs locally in your browser. Your input never leaves your device, so it is safe to use with private or proprietary data.

Is Formatter free?

Yes. Every tool is free to use with no sign-up and no limits. A few ads around the tools keep the site running; they never appear inside the editors.