1. Home
  2. Developer tools
  3. HTML, CSS & JS Minifier / Beautifier

HTML, CSS & JS Minifier / Beautifier

Shrink a script or stylesheet for a page that has no build step, or make minified code readable to debug it.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use HTML, CSS & JS Minifier / Beautifier

  1. Paste code; the language is detected.
  2. Choose Minify or Beautify.
  3. Copy or download the result.

Features

  • JavaScript minified with Terser: compression, dead-code removal, optional name mangling
  • CSS: comments, whitespace, zero units and long hex colours removed
  • HTML: comments and indentation removed; pre, textarea, script and style kept
  • Beautify with js-beautify, 2 or 4-space indents
  • Before and after sizes

Supported formats

You can open

  • JS
  • CSS
  • HTML

You get

  • JS
  • CSS
  • HTML

Private by design

Your files are opened and processed by your browser on this device. They are never uploaded to openWorkstand or anyone else, so the HTML, CSS & JS Minifier / Beautifier is safe for contracts, IDs, photos and work documents. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Code with syntax errors cannot be minified; the error position is shown.

Guide

Minifying and beautifying JavaScript, CSS and HTML

Minified code loads faster: fewer bytes to download, less to parse. Readable code is easier to debug. Most projects get both from a build tool, but a small site, an embedded widget or an email template often has no build step. This tool minifies JavaScript, CSS and HTML in the browser, or beautifies minified code back into a readable layout.

JavaScript with Terser

JavaScript is minified with Terser, the minifier behind most bundlers. It removes whitespace and comments, but also rewrites code into shorter equivalents: conditions become ternaries, constant expressions are folded, unreachable code is dropped, and two compression passes find more savings. With name mangling on, local variables and parameters get one-letter names; global names and object properties are never renamed, so the code keeps working when other scripts use it. Licence comments starting with /*! or containing @license or @preserve are kept. If the code has a syntax error, Terser cannot parse it, and the error is shown with its line and column.

CSS

The CSS minifier removes comments, collapses whitespace, and drops the semicolon before each closing brace. It also applies safe shortenings: 0px becomes 0, 0.5 becomes .5, and six-digit colours with paired digits such as #ffffff become #fff. Strings are copied untouched, and the spaces around + and - inside calc(), which CSS requires, are preserved.

HTML

HTML minification removes comments (except conditional comments), deletes the indentation between tags and collapses other runs of whitespace to a single space, since a space between inline elements is visible. The contents of pre and textarea, where whitespace is meaningful, and of script are left as they are; CSS inside style is minified with the CSS rules above.

Minify, then compress

Servers usually compress text with gzip or Brotli. Compression removes repetition; minification removes characters compression cannot, such as comments and long local names. They work best together, which is why build tools do both.

Beautifying

Beautify reverses the layout of minified code with js-beautify: line breaks, indentation of 2 or 4 spaces, and spacing around operators. It cannot restore original variable names or comments, but it makes a third-party script or a production bundle readable enough to follow.

A worked example

The sample is a 13-line debounce function with comments. Minified with mangling, it becomes a single line beginning export function debounce(e,t=300){let n=null;…, and the panel shows a 54 per cent reduction. The CSS rule .card { margin: 0px auto; background-color: #ffffff; } becomes .card{margin:0 auto;background-color:#fff}.

When to use a build tool instead

For an application with many modules, a bundler such as Vite, esbuild or webpack minifies as part of the build, removes unused exports and produces source maps that map errors back to your original code. Use this tool for single files, quick checks and pages without a build pipeline.

Checking the result

After minifying JavaScript, run the page once and watch the console: errors usually mean the original relied on something unusual, such as reading a function’s name at runtime. Keep the readable original in version control and treat the minified file as a build output you can regenerate.

Format JSON with the JSON Formatter, escape snippets for HTML with the HTML Encoder, compare two versions in the Diff Checker, or turn Markdown into HTML with Markdown to HTML.

Checked against the current version of the HTML, CSS & JS Minifier / Beautifier on .

Troubleshooting

The file does not open

Check that it is one of the supported formats above and opens in another app. Damaged files and password-protected PDFs cannot be read until they are repaired or unlocked.

It is slow or stops on a very large file

Everything runs on your device, so speed depends on its memory. Close other tabs, use a computer rather than a phone, or split the file into smaller parts first.

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Is it safe to mangle names?

Mangling renames only local variables and parameters, which cannot be seen from outside a function, so behaviour does not change. Global names, object properties and exports are left alone. Turn it off if you want readable stack traces from the minified file.

Why did my CSS hack stop working?

Some old browser hacks rely on comments or odd whitespace that minification removes. Modern CSS rarely needs them; if one is essential, keep that rule in a separate file and do not minify it.

How much smaller will my files get?

Typically 20 to 60 per cent before compression, depending on how many comments, long names and how much indentation the original has. The panel shows the exact change for your code.

Is minifying still worth it with gzip?

Yes. Compression and minification work on different redundancy: minifying removes comments and whitespace and shortens names, then gzip or Brotli compresses what is left. Together they usually beat either alone.

Can beautifying restore the original code?

It restores layout, not names or comments. Shortened variable names stay short, so for debugging production code a source map from the original build is better.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.