Minify and compress code in your browser

Drop an HTML, CSS, JavaScript, JSON or XML file. It stays in this tab, and we send you to the matching minifier.

Drop your code here

or browse your device. We open the matching minifier

Code and markup

Pick a format, or drop a file and we will.

Each card is a live compressor. Same privacy model as the rest of the site: the file is processed in this tab and never sent anywhere.

How it works

How to minify code

01

Drop the file

A stylesheet, a script, a page, a config file or a data export. It is read in this tab and never sent anywhere.

02

Land on the matching minifier

Each language has its own tool with its own rules, because what is safe to remove from CSS is not safe to remove from XML.

03

Check and save

The result panel shows what came off. Download it, or copy it straight to the clipboard to paste back into your project.

Looking for a different format?

The home page routes any file we can compress, including code, fonts and ZIP archives.

See every format

What minifying is worth, honestly

Minifying removes what a person needs and a machine does not: indentation, line breaks, comments, and in some languages the long names people give things. It never changes what the code does, and each tool here refuses to guess when a change would. The JSON tool parses the data and refuses invalid input; the XML tool keeps CDATA, entities and every closing tag; the CSS tool leaves the cascade in the order you wrote it.

It is worth less than people expect once a server compresses the response. Gzip and brotli are very good at squeezing out exactly the repetition that indentation is made of, so a file that minifies 30% smaller may only be 5 to 15% smaller once both versions are compressed on the wire. Minify anyway if you are shipping by hand, but turn on compression at your host first: that is the bigger win, and most hosts already do it.

Where minifying earns its keep is JavaScript, because renaming local variables removes bytes that compression cannot, and files that are stored or sent without compression, such as a JSON payload saved to disk or an XML feed attached to an email.

Questions

How do I minify code without uploading it?

Drop the file on this page. It is read in your browser and sent to the HTML, CSS, JavaScript, JSON or XML tool on this site, which minifies it in the same tab. There is no upload endpoint, so source code that is not public yet stays that way.

Which languages can I minify here?

HTML, CSS, JavaScript, JSON and XML. Each has its own page, listed above, because the safe rules differ between them.

Will minifying break my code?

It should not, and each tool is conservative on purpose. The JavaScript tool only renames variables when you ask it to, the JSON tool refuses anything that does not parse, and the XML tool keeps every closing tag. Test the result before you ship it all the same, as you would any build step.

Should I minify or turn on gzip?

Turn on gzip or brotli first, because it saves more on every text file your server sends. Minify as well if you can: the two stack, though the extra saving from minifying is smaller once the file is compressed.

Is this code minifier free?

Yes. The work runs on your own machine, so there is no account, no limit on file size beyond your device, and nothing to pay.