Code Formatters

Beautify code to read it, minify it to ship it, both in the browser. 10 free tools, no sign-up, and they run in your browser.

All 10 code formatters

Tidy or shrink HTML, CSS, JavaScript, XML, SQL and Markdown.

CSS Formatter

Format CSS with consistent indentation, spacing and one declaration per line.

Code Formatters Use tool

CSS Minifier

Minify CSS by removing comments, whitespace and redundant characters.

Code Formatters Use tool

HTML Formatter

Pretty-print HTML with consistent indentation, or collapse it back down.

Code Formatters Use tool

HTML Minifier

Shrink HTML by removing comments and collapsing whitespace, safely.

Code Formatters Use tool

HTML to Markdown

Convert HTML into Markdown, keeping headings, lists, links and tables.

Code Formatters Use tool

JavaScript Formatter

Format JavaScript with consistent indentation, spacing and statement breaks.

Code Formatters Use tool

JavaScript Minifier

Shrink JavaScript by removing comments and whitespace, without renaming anything.

Code Formatters Use tool

Markdown to HTML

Turn Markdown into HTML with a live preview and escaped output.

Code Formatters Use tool

SQL Formatter

Format SQL with keywords, clauses and joins on their own lines.

Code Formatters Use tool

XML Formatter

Pretty-print XML with proper indentation, and catch malformed documents.

Code Formatters Use tool

About code formatters

Formatting and minifying are the same operation in opposite directions: one adds the whitespace a person needs, the other removes everything a machine does not. Both are here for each language, and both report what changed -- the size saved, or the number of lines produced -- so you can see the tool did something sensible.

Reading code

The HTML formatter, CSS formatter, JavaScript formatter, XML formatter, SQL formatter and JSON formatter indent consistently and preserve the meaning of what you pasted. Minified code pasted into any of them becomes readable again, which is the usual reason to open one.

Shipping code

The HTML minifier, CSS minifier, JavaScript minifier and JSON minifier strip comments and unnecessary whitespace and show the saving in bytes and per cent. These same minifiers build this site's own CSS and JavaScript, so they are exercised on real input every time it is rebuilt.

Markdown and HTML

Markdown to HTML and HTML to Markdown convert in both directions, and the live HTML editor shows a rendered preview as you type, which is the fastest way to test a snippet.

Code Formatters A to Z

Every tool in this category, in alphabetical order.

Frequently asked questions

Is my code sent to a server?

No. Formatting and minifying both happen in your browser, so proprietary source stays on your machine.

Is the JavaScript minifier safe for production?

It removes comments and whitespace and makes safe substitutions. It does not rename variables or restructure code, so it is safer than an aggressive minifier and saves less. For a build pipeline, use a dedicated bundler.

Can a formatter fix broken code?

No. It can only format what parses. Where it cannot parse your input it says where it gave up, which usually points straight at the missing bracket or quote.

Does minifying change what the code does?

It should not, and these minifiers verify their own output: the CSS minifier checks the rule count is unchanged and the JavaScript minifier checks the brackets still balance.

Other categories

The rest of the collection, including every calculator.

Everyday Tools

Timers, counters, pickers and the small tools you reach for daily.

14 tools

Text Tools

Count, clean, convert and reorder any block of text.

13 tools

Image Tools

Compress and resize pictures without uploading them.

14 tools

Color Tools

Pick colours and convert between HEX, RGB and HSL.

6 tools

Utility Tools

Passwords, QR codes and other everyday helpers.

9 tools

SEO Tools

Links, meta tags, schema markup, redirects and SERP previews.

34 tools