Code Beautifier
Beautify code in 14 languages – JavaScript, TypeScript, JSON, HTML, CSS, SCSS, Less, XML, YAML, GraphQL, Markdown, SQL, PHP and Python – in your browser.
Runs entirely in your browser. Your data is never uploaded.
Related Tools
View AllWhat is Code Beautifier?
The Code Beautifier formats source code in many languages from a single page. Pick the language and indentation and get consistently formatted code produced by established formatters (Prettier, Ruff, sql-formatter, xml-formatter).
How to use Code Beautifier
- Choose the Language.
- Choose the Indentation.
- Paste your code and click Format (most languages also update while you type).
- Copy or download the result.
Example
const a={b:1,c:[1,2]} const a = { b: 1, c: [1, 2] }; Language: JavaScript, 2 spaces.
When to use Code Beautifier
Use it to quickly format code in a language you do not have tooling for, or to format snippets for documentation. For projects, configure the same formatter in your editor or CI so output stays consistent. Formatting never fixes logic errors.
How Code Beautifier works
The selected language decides the engine: Prettier 3 for JavaScript (Babel parser), TypeScript, HTML, CSS, SCSS, Less, YAML, GraphQL, Markdown and PHP (@prettier/plugin-php); a strict JSON printer for JSON; xml-formatter for XML; sql-formatter (standard SQL, uppercase keywords) for SQL; and Ruff compiled to WebAssembly for Python. Engines are downloaded only when first used. Syntax errors are reported with line and column where the engine provides them.
Common Use Cases
- Formatting a TypeScript snippet without installing Prettier
- Cleaning up code copied from a chat or PDF
- Formatting Markdown tables and lists
- Switching code between 2-space and 4-space indentation
Security Note
Everything runs locally in your browser; the code you paste is not uploaded.
FAQs
Which style does JavaScript formatting use?
Prettier's defaults: double quotes, semicolons, 80-character lines.
Why is Python slow the first time?
The Ruff WebAssembly engine is downloaded on first use.
Can I choose a SQL dialect?
Use the SQL Formatter page for dialect and keyword-case options.