Code Formatter Workspace

Choose the language and format your source with Prettier. Compare or copy the output; the workspace does not execute your code.

Runs locally in your browser
LOCAL EDITORMonaco 0.56.0Prettier 3.9.6Nothing is uploaded
Code is formatted entirely in your browser. The editor and formatter are self-hosted by VoriTools and do not send a snippet to a remote API.
Source

The enhanced editor loads only on this page. If it cannot start, the same local formatter stays available in the fallback field.

Formatted output

Formatting changes whitespace and layout; always retain a project copy before applying broad code transformations.

How to format code in the workspace

The workspace formats eight languages — JavaScript, TypeScript, JSON, CSS, HTML, Markdown, YAML and GraphQL — with Prettier 3.9.6 running inside the page. Choose the language, put the source in the left pane and press Format code; the right pane shows the result.

The enhanced editor is Monaco 0.56.0, loaded from this site after the page itself: the plain-text pane works immediately and keeps working if the editor cannot start. Between the two, the page serves about 1.8 MB of editor and formatter files from voritools.com, and nothing you paste is sent anywhere.

  1. Pick the language in the dropdown. The page opens with a JavaScript sample; while you have not edited the field, changing the language swaps the sample for one in the new language, and Load example reloads it at any time.
  2. Paste the source into the left pane. The plain-text pane is usable before the enhanced editor has finished loading, and text typed there moves into the editor when it starts.
  3. Press Format code. Prettier runs in the page and the indented result appears in the right pane; the status line reports when it is done.
  4. Press Copy output to put the result on the clipboard, or Use output as source to load it back into the left pane for another pass.
  5. If formatting fails, the message names the reason and the output pane is emptied, so a result from an earlier run cannot be mistaken for the new one.

Languages, defaults and limits

The eight languages and the parser behind each

JavaScript and TypeScript go through the Babel and TypeScript parsers, so JSX and type syntax pass through and generics such as <T,> keep working. JSON, CSS, HTML, Markdown, YAML and GraphQL each have a dedicated parser: unclosed HTML tags are closed, for example, and a minified CSS rule is printed with one declaration per line. Every language has a sample behind Load example.

There is no options panel, so Prettier’s defaults are used as they come: two-space indentation, double quotes and semicolons in JavaScript and TypeScript, trailing commas in multiline constructs, and an 80-column print width. The page only changes whitespace and layout; it does not execute the code, install dependencies or read a project’s .prettierrc, so the result can differ from the same file formatted by a project script that sets its own options.

What the JSON view accepts, and what it leaves in place

The JSON view is Prettier’s JSON parser, not a strict RFC 8259 validator. Measured on this page: a document with single-quoted strings, unquoted keys, a trailing comma, a // comment, a hexadecimal number or Infinity formats without an error. Single quotes, unquoted keys and trailing commas are rewritten in the output; comments, 0x10 and Infinity are carried through unchanged.

A document can therefore format cleanly here and still be rejected elsewhere: {"a":1} // note and {"a":Infinity} come back with the comment and the Infinity value intact. Before the result goes to an API, a configuration file or another language, check it with the JSON Formatter page, which rejects comments and trailing commas.

What stays local, and where the limits are

Prettier and the editor are served from this site, and formatting happens in the browser: the page sends neither the source nor the result anywhere, and it keeps working after the network drops. If the editor cannot start, the same formatter stays available in the plain-text pane.

Because the work happens in the tab, large files are limited by the memory of the device — a 112 KB JavaScript file was formatted in about 0.2 seconds here, while a file of many megabytes can freeze the tab. Keep the file under version control before replacing it with the output: the formatter rewrites syntax as Prettier prints it, not as it was written.

Recent tools: