Minify Code
Minify or beautify HTML, CSS and JavaScript by pasting your code.
What does it mean to minify and unminify code?
Minifying code strips out everything the browser doesn't need (whitespace, line breaks and comments) so the file is smaller and the page loads faster; unminifying is the reverse: turning compressed code back into readable, indented code. This free tool does both for JavaScript, CSS, HTML and JSON, right in your browser with no signup. Your code is never uploaded to a server and no copy is kept: everything is processed in your device's memory. To minify it uses Terser (JavaScript), csso (CSS) and html-minifier (HTML); to unminify and beautify it uses Prettier, which adds line breaks and indentation. It detects the language when you paste, and when minifying it shows the size before and after. One caveat: unminifying makes code readable, but it can't bring back comments or the original variable names.
How to use Minify Code
- Pick a mode: "Minify" to shrink your code, or "Unminify / Beautify" to read compressed code.
- Paste your JavaScript, CSS, HTML or JSON into the input panel. The language is detected automatically; if it guesses wrong, pick it manually from the tabs (the Auto button turns detection back on).
- Tune the options: when minifying, mangle variable names, compress, remove comments or collapse whitespace; when unminifying, choose the indentation (2 spaces, 4 spaces or tab).
- Copy the result or download it. Minifying shows the percentage you saved; unminifying shows the line count of the reformatted code.
Privacy
Common use cases
Optimize frontend assets for production
Minify your HTML, CSS and JavaScript before deploying to cut file sizes, reduce load time and improve your Google PageSpeed and Core Web Vitals scores.
Read and debug minified JavaScript
When you need to inspect a compressed script from a theme, a plugin or a .min.js file on your own site without its source, unminify it to get one statement per line and follow the logic. Short names (a, b, c) stay, but the code becomes navigable again.
Inspect compressed CSS and HTML
Beautify a minified stylesheet to find the rule that overrides another, or reformat a one-line HTML template or email so you can see its structure before editing it.
Snippets for CMS and third-party pages
Minify the CSS or JavaScript you paste into WordPress, Shopify, a tag manager or a landing page editor, where every injected kilobyte counts and a single compact block is easier to manage.
Proprietary code without the risk
Minify or unminify client and internal code without pasting it into tools that send it to someone else's server: everything runs locally in your browser and no copy of your code is kept.
Frequently asked questions
How do I unminify JavaScript online?
Switch to "Unminify / Beautify" mode, paste your JavaScript, and the tool reformats it instantly with one statement per line and the indentation you choose (2 spaces, 4 spaces or tab). It runs in your browser, with no upload and no account. If the code has a syntax error, you get the line and column.
How do I beautify or unminify HTML?
Choose "Unminify / Beautify" mode, select HTML (or let it auto-detect) and paste your markup. The output is indented by tag, and the contents of any inline <script> and <style> blocks are formatted too. It helps when you're reading templates, emails or saved pages that were squashed onto a single line.
How do I beautify minified CSS?
Paste the CSS in "Unminify / Beautify" mode and you get one selector per block, one declaration per line and consistent spacing, including rules nested in @media. It's the quickest way to read a .min.css file or the compiled CSS of a theme.
Does unminifying restore my original code?
No. Unminifying only reformats: line breaks, indentation and spacing. Comments removed during minification can't be recovered, and if the JavaScript was minified with variable mangling, names like a, b or c stay short. That's why you should always keep the original unminified source and use the minified version only in production.
How do I minify JavaScript, CSS or HTML online, and how much smaller does it get?
Leave the mode on "Minify", paste your code and pick the language (or let it auto-detect): the result appears instantly, with nothing to install or upload. How much you save depends on the original: a file with lots of indentation and comments shrinks far more than one that's already compact. The tool shows the exact percentage saved for your file.
Can minification break my JavaScript?
Removing whitespace, line breaks and comments doesn't change what the code does. The variable-renaming option (mangle) only touches local variables and is safe for normal code, but turn it off if your code relies on reflection or dynamic property names. Always test the output before deploying.
Can I minify PHP with this?
Minifying PHP doesn't pay off the same way: PHP runs on the server and users never download that code, so shrinking it doesn't speed up page loads. What does help is minifying the HTML, CSS and JavaScript your PHP sends to the browser, which is what this tool does.
What's the difference between minifying and gzip compression?
They are complementary. Minifying removes unnecessary characters from the source; gzip or Brotli compress the file during HTTP transfer and the browser decompresses it on arrival. A minified file served with gzip is the best combination: minification still saves bytes even after compression.
Is it safe to paste proprietary or client code here?
Yes. Unlike online minifiers that process your code on their servers, Docuboxer minifies and unminifies locally in your browser. Your code is never transmitted over the internet or saved; your browser keeps only the usage history (tool, date, text size and, if it fails, a generic error notice), and you can clear it in Recents.