Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Code Formatter (TypeScript, Vue, Markdown & more)

Prettier for 18 languages — auto-detected, configurable, with a diff of every change.

Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 / $5.99 for 30 days On this device: nothing is sent
+3 +1 more details No uploadWorks offline once opened Developer

Free preview: the first lines of the formatted code and of its diff (up to 20), with the language, every error and the line counts. Locked until you unlock it: download and copy.

Pro pass ₹179 for 30 days or ₹79 for 1 week, one‑time. Pro pass $5.99 for 30 days or $2.99 for 1 week, one‑time. How to unlock

Try before you buy.

  • Free preview: the first lines of the formatted code and of its diff (up to 20), with the language, every error and the line counts.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment unless you choose automatic renewal. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment unless you choose automatic renewal.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

Formatted in your browser with Prettier 3.9.9. Nothing is uploaded.

Options
Ctrl/⌘ + Enter

Next steps Done. What next?

Start over

A Pro pass unlocks the full result. See passes

All developer tools

About the Code Formatter (TypeScript, Vue, Markdown & more)

Paste code and format it with Prettier — the opinionated formatter used by most JavaScript and TypeScript projects — without installing anything. It covers the languages the other formatters on this site do not: TypeScript and TSX, Vue single-file components, Angular templates, Handlebars, Markdown and MDX, YAML, GraphQL, SCSS and Less, and JSON5 and JSON with comments, plus JavaScript, JSX, JSON, CSS and HTML.

The language is detected automatically (or from the file name), and you can set the usual Prettier options: print width, tabs or spaces, semicolons, quotes, trailing commas, bracket spacing, arrow parentheses, Markdown prose wrapping and HTML attribute layout. Changes shows a line-by-line diff of what Prettier changed. Formatting runs in a background thread in your browser, so large files never freeze the page and nothing is uploaded.

Without a pass you see a free preview: the language, every error and the line counts, with the first lines of the formatted code and of the diff. A Pro pass unlocks the whole result, with Copy, Download and Use as input.

How to use it

  1. Paste code, drop a file or open one. Leave Language on Auto-detect, or pick the language yourself.
  2. Adjust Options if your project uses different Prettier settings (for example single quotes, no semicolons or 4-space indents).
  3. Press Format (or Ctrl/⌘ + Enter).
  4. Check Changes to review the diff, then Copy or Download the result — with a pass, or after unlocking this result.

Examples

TypeScript
Input
const a = {b:1,c:[1,2,3]} ;function f(x: number): string {return `${x}`}
Result
const a = { b: 1, c: [1, 2, 3] };
function f(x: number): string {
  return `${x}`;
}
YAML
Input
a:   1
b: [1,2]
Result
a: 1
b: [1, 2]
GraphQL
Input
query{user(id:1){name}}
Result
query {
  user(id: 1) {
    name
  }
}

Common uses

  • Cleaning up TypeScript, React (TSX/JSX) or Vue code copied from a chat, a gist or documentation.
  • Formatting GitHub Actions, Kubernetes or Docker Compose YAML before committing it.
  • Tidying Markdown and MDX documentation tables and lists.
  • Checking how Prettier would format a file with your team's settings, without setting up a project.

Languages and options

  • Scripts: TypeScript, TSX, JavaScript and JSX — semicolons, quotes, trailing commas, bracket spacing and arrow parentheses apply.
  • Data: JSON, JSON5 and JSON with comments (keys and quotes are kept as JSON5 allows).
  • Styles: CSS, SCSS and Less.
  • Markup: HTML, Vue single-file components (including <script setup lang="ts">), Angular templates (*ngFor, @if, bindings) and Handlebars/Glimmer templates — attribute layout and whitespace sensitivity apply; Vue can indent <script> and <style>.
  • Docs and config: Markdown and MDX (prose wrap: keep, wrap or unwrap long lines) and YAML.
  • GraphQL: queries, mutations and schema definitions.

Options are Prettier's own, with Prettier's defaults (print width 80, 2 spaces, semicolons, double quotes, trailing commas everywhere). Prettier version: 3.9.9 (MIT licence). Code inside Markdown fences in JavaScript, CSS or YAML is formatted too.

Other formatters

For JavaScript with more style choices (brace style, keeping array indentation) use the JavaScript Formatter; there are also dedicated formatters for CSS, HTML, SQL, JSON and XML, and a YAML Validator.

Limitations

  • Prettier deliberately has few options; layout choices it does not offer (for example aligning colons) cannot be configured.
  • Code must be syntactically valid to be formatted: Prettier stops at the first syntax error and shows where it is.
  • Prettier plugins for other languages (PHP, Java, Svelte, Astro…) are not included.
  • The first format of a language downloads Prettier (about 27 KB compressed) and the plugins that language needs — about 12 KB for GraphQL, 275 KB for TypeScript and 450 KB for Vue — after which it works offline.

Privacy

On this device: nothing is sent

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

How to check that nothing is uploaded

Frequently asked questions

What do I get without a pass?

Without a pass, Code Formatter (TypeScript, Vue, Markdown & more) shows the first lines of the formatted code and of its diff (up to 20), with the language, every error and the line counts. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment unless you choose automatic renewal, unlocks the full result. The pricing page lists the passes and their prices.

Is this the real Prettier?

Yes — Prettier 3.9.9's official browser build and plugins, the same code that runs in editors and on the command line, so the output matches npx prettier with the same options.

How do I match my project's .prettierrc?

Set the same values under Options: printWidth, tabWidth/useTabs, semi, singleQuote, trailingComma, bracketSpacing, bracketSameLine, arrowParens, proseWrap, singleAttributePerLine and htmlWhitespaceSensitivity. Your choices are remembered in this browser.

Why was my code detected as the wrong language?

Short snippets can fit several languages (a TypeScript type can look like JavaScript, a YAML file like Markdown). Pick the language from the list and format again; opening a file uses its extension, which is always right.

Is my code uploaded?

No. Prettier runs in a background thread of your browser. Only Prettier's own files are downloaded from this site the first time each language is used.

Do I need a pass?

To copy, download or use the whole formatted code, yes: a Pro pass unlocks every Pro tool. Without a pass you see a free preview of your own result: the first lines of the formatted code and of its diff (up to 20), with the language, every error and the line counts. Your code is never locked and never uploaded.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.