Skip to content
Marvin's Toolbox.

Search tools

Type to filter all tools

Code Formatter

Format code in JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, LESS, Markdown, YAML, GraphQL, XML and SQL. Pick tabs or spaces, set the indent width, and format the input in place with one click.

Everything runs locally in your browser. Your data never leaves your device.

Language and options

JavaScript includes JSX

Next steps

Keep going. These tools open with your result loaded in.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

Paste a UUID to see what it carries: version, variant, and for time-based versions the exact timestamp, clock sequence and node. Also shows the raw bytes, the 128-bit integer and the URN form.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.

Convert between scientific notation and full numbers as you type. Reads 1.23e5, 1.23 × 10^5 and plain numbers, shows the value written out, in normalized scientific notation and in engineering notation, and can round to any number of significant digits.

About the Code Formatter Tool

This tool formats code in place. Paste a snippet, pick tabs or spaces, and click Format, the tidied result replaces the input in the same editor. Prettier handles JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, Less, Markdown, YAML, GraphQL and XML, and sql-formatter handles SQL.

The language picker follows what you paste, so JSON, SQL, HTML and most other snippets are recognized on their own. A guess is never sticky, choosing a language by hand always wins.

What you can do

  • Format JSON online with your own indent width.
  • Beautify minified JavaScript or TypeScript, including JSX and TSX.
  • Format SQL queries in dialects from PostgreSQL and MySQL to BigQuery and Snowflake, with keyword casing.
  • Tidy up HTML pages, Vue single-file components and XML documents.
  • Format CSS, SCSS and Less stylesheets.
  • Clean up Markdown, YAML and GraphQL files.
  • Convert code indentation between tabs and spaces.
  • Set Prettier options like print width, semicolons, single quotes and trailing commas.

How to use the Code Formatter

  1. 1Paste your code into the editor. The language picker updates on its own, or set it yourself.
  2. 2Choose tabs or spaces, and the indent width for spaces.
  3. 3Open More options for print width, semicolons, quotes and trailing commas. For SQL, pick the dialect and keyword case instead.
  4. 4Click Format. The result replaces your input, and Revert format or Ctrl+Z brings the old version back.
  5. 5Copy the result or download it with the matching file extension.

What happens on a syntax error

Formatting needs code that parses. When the input has a syntax error, the tool keeps your text exactly as it is and shows the parser's message with the line and column where it stopped. Fix the spot it points at and format again.

Formatting is not converting

This tool changes how code looks, never what it means. To turn data from one format into another, like JSON into YAML, use the Config Converter instead. To shrink an SVG rather than pretty-print it, use the SVG Optimizer.

Credits

Open source does the heavy lifting in this tool. Thank you to:

  • Prettier

    The opinionated code formatter used across the JavaScript ecosystem.

  • SQL Formatter

    A formatter for SQL in all its many dialects.

Everything this site builds on is listed on the credits page.

Convert config and data between JSON, YAML, TOML, JSON5, INI, XML, CSV and .env. Type or paste on the left, pick the output format on the right, and copy the result. Includes a format button and a minify toggle.

Paste or drop application logs and read them as a clean, structured list. Detects logfmt, JSON lines and common plain-text formats, colors levels and timestamps, and lets you expand or collapse the fields of every entry.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Generate realistic fake data for testing: names, emails, addresses, phone numbers, companies, internet data, dates and more. Tick the fields you need, set how many rows you want and a locale, then copy or download the result as JSON, CSV or plain text.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.