Skip to content
Tools on Deck

Code Formatter

Prettify JS, TS, CSS, HTML, YAML and more.

Processed locallyFreeNo sign-up

Code Formatter tool

About this tool

A code formatter applies consistent spacing, wrapping, quotes, and punctuation to supported source files. This editor uses Prettier 3 for JavaScript, TypeScript, JSON, CSS, SCSS, LESS, HTML, Markdown, YAML, and GraphQL. It is useful when copied snippets are hard to read or a file needs consistent style before a review.

Your source is processed entirely in the browser, never uploaded, and discarded when you close the tab. Choose spaces or tabs, set an indent size and print width, then control quotes and semicolons where the selected language supports them. Press Ctrl+Enter on Windows or Cmd+Enter on macOS to format without reaching for the button.

How to use the Code Formatter

  1. 1Paste source code into the editor and select its language.
  2. 2Set the indent style and print width for your preferred layout.
  3. 3Choose single or double quotes and the semicolon setting when available.
  4. 4Press Ctrl or Cmd plus Enter to run Prettier 3.
  5. 5Review the formatted source, then copy the result you want to keep.

Features

Ten language choices

Format common web, data, documentation, stylesheet, and query languages in one editor.

Prettier 3 engine

Apply the established Prettier printer rather than simple whitespace replacement rules.

Flexible indentation controls

Pick tabs or spaces and set the indentation width used in formatted output.

Configurable line wrapping

Set a print width to guide how Prettier wraps longer expressions and markup.

Keyboard formatting shortcut

Run the formatter with Ctrl+Enter or Cmd+Enter while staying in the editor.

Frequently asked questions

Which languages can this code formatter handle?

It supports JavaScript, TypeScript, JSON, CSS, SCSS, LESS, HTML, Markdown, YAML, and GraphQL. Select the correct language so Prettier uses the matching parser.

Why does Prettier wrap code before my chosen width?

Print width is a formatting guide, not a strict character limit. Prettier may break some structures earlier or leave indivisible strings longer.

Can I format with tabs and no semicolons?

Yes for languages where those choices apply. Select tabs for indentation and turn semicolons off before formatting JavaScript or TypeScript.

What keyboard shortcut formats the current source?

Use Ctrl+Enter on Windows and Linux, or Cmd+Enter on macOS. The same settings are applied as when you use the format control.

Does my source code get uploaded?

No. Prettier runs on the page in your browser, and your source is not stored after you close the tab.