Code Formatter & Minifier

Runs in your browser

Make messy HTML, CSS, JavaScript, TypeScript, JSON, XML, SQL, Markdown, YAML and more readable, or shrink HTML, CSS, JavaScript, JSON, XML and SQL. Your code is processed inside this browser tab and is not uploaded.

0 bytes · 0 lines Maximum 5 MB · nothing uploaded

Press Tab inside the editor to insert an indent. The formatter never executes your code.

Lines longer than this wrap where the language allows it.

Result

No result yet

Ready

Paste code, open a file, or load an example to begin.

Nothing is uploaded

Formatting and minifying run in a Web Worker in this tab. Your source code never reaches AppCenter's servers.

Real parsers, not regexes

Prettier, Terser and csso parse the code before printing it, so a comment marker inside a string is left alone.

Errors keep your input

A syntax error reports the line and column and leaves the editor untouched, so nothing is lost while you fix it.

When to format and when to minify

Formatting changes whitespace and line breaks so code is easier to read, review and diff. It should never change behaviour: every statement, string and comment keeps its meaning.

Minification is the opposite trade. It removes comments and unnecessary whitespace to reduce transfer size. Use it for files you ship, and keep the formatted original in version control, because minified code is painful to review and to debug.

How to use the tool

  1. Paste your code, open a file, or press Load example.
  2. Choose the language. Opening a file selects it from the extension where possible.
  3. Adjust indent, line width, quotes and semicolons. SQL also has a dialect selector.
  4. Press Format code, Minify code or compare with the Diff tab.
  5. Copy the result or download it, then keep the formatted file as your source of truth.

Worked example: formatting a build helper

Input, written without consistent spacing:

const  builds=[{id:1,target:"ios",status:"passed"},{id:2,target:"android",status:"failed"}];
function  label(b){return b.target+": "+b.status}
console.log(builds.map(label).join(", "))

Output with JavaScript selected, 2-space indent, double quotes and semicolons:

const builds = [
  { id: 1, target: "ios", status: "passed" },
  { id: 2, target: "android", status: "failed" },
];
function label(b) {
  return b.target + ": " + b.status;
}
console.log(builds.map(label).join(", "));

The same input through Minify becomes a single 181-byte line, down from 184 bytes before compression: object spacing, the redundant braces style and the trailing semicolon arrangement all collapse while the three statements stay separate and valid.

The Diff tab shows the identical rewrite line by line, with removed lines marked red and added lines green, so you can check a formatter change before committing it.

Why minifying is not just deleting spaces

JavaScript has no required whitespace between many tokens, but it does depend on newlines in a few places and on whitespace inside strings, template literals and regular expressions. A script that strips spaces with a regular expression will happily break "a // b" or a regex literal.

This tool compiles JavaScript with Terser, so it parses the file into a syntax tree and prints a smaller but equivalent program. If the file does not parse, you get an error with the line and column instead of a mangled result.

CSS minification uses csso, which understands selectors, at-rules and custom properties. HTML, XML and SQL are handled conservatively: comments and indentation go, and then nothing else changes. Text inside <pre>, <textarea>, <script>, <style>, CDATA and quoted SQL strings is copied byte for byte.

Languages, limits and common errors

Language Format Minify
HTML, CSS, JavaScript, JSON, XML, SQL Yes Yes
TypeScript, JSX, TSX, SCSS, Less, Markdown, YAML, GraphQL Yes No

Each editor accepts up to 5 MB of text. PHP, Swift, Kotlin and Dart are not offered here because no browser formatter for them has been verified, and showing an unreliable one would be worse than leaving it out.

  • “Could not process the input (line 4, column 12)”: the parser stopped there. The message keeps your original text; fix that position and run again.
  • “No minifier for this language”: the Minify tab covers HTML, CSS, JavaScript, JSON, XML and SQL only. Use Format for the others.
  • HTML looks unchanged: the file may already be minified, or the remaining savings are inside attributes that are left as written.
  • SQL formatting moves a dialect-specific keyword: change the SQL dialect selector; syntax such as TOP, LIMIT or backticked identifiers is dialect-dependent.

How your code is processed

Everything runs in a Web Worker started by this page, using libraries bundled with the site. No request carries your code, and the tool loads no third-party script at runtime. Closing the tab discards the worker and everything in it.

Local processing is a privacy feature, not a security review. Formatting does not look for malicious code, and minified output is still code you should read before you ship it.

Frequently asked questions

Does formatting change what my code does?

It should not, and this tool only reformats parsed code. Behaviour can still differ if the original relied on automatic semicolon insertion in an unusual way, so review the diff before committing a bulk reformat.

Why is TypeScript missing from Minify?

Minifying TypeScript means stripping types first, and that is a compile step with its own decisions about decorators and module targets. Run your build tool for that, then minify the JavaScript output here.

Will minified JavaScript still parse?

Yes, Terser refuses to emit output it cannot parse. Only syntax that Terser supports is accepted, so very new proposals may be rejected with an error rather than mangled.

Can I format a file straight from disk?

Yes. Open file reads the text in the browser, picks the language from the extension, and never sends the file anywhere. The 5 MB limit applies to the text, not to the name.

Does the formatter support JSX and TSX?

Yes, both format. Neither has a minifier here, because minifying JSX would require compiling it with your project's React or Preact settings.

Related tools and sources

To check structured data instead of reformatting it, use JSON & Data Studio; to encode values, use Encode & Decode; to compare two versions of a text document, use Text Studio.

References: the Prettier documentation for formatting options, the Terser and csso project documentation for minifier behaviour, and sql-formatter's dialect list for SQL keywords. Behaviour checked in current Chromium on 28 November 2026.

Read the guide