# CSS and JS Minifier

> Minify CSS or JavaScript snippets online. Strips comments and extra whitespace, shows original and minified character counts, and copies output.

- Page: https://mondaytool.com/tools/css-js-minifier
- Category: developer-tools
- Price: free, no sign-up. Most tools run in the browser, so input is not uploaded.
- Use it: open https://mondaytool.com/tools/css-js-minifier. It is an interactive web page; this file is its documentation.

Last updated: 13 October 2026

## Minify CSS or JavaScript snippets

This **JS and CSS minifier** makes a code snippet smaller by removing comments and extra whitespace. It is a lightweight tool for quick jobs, such as shrinking an embed or a demo, not a replacement for a full build tool like a bundler or compressor.

## How to use it

1. Choose **CSS** or **JavaScript** mode.
2. Paste your code into the Source code box. The minified output updates as you type.
3. Compare the original and minified character counts and the characters saved.
4. Click **Copy output** to copy the result.

## What the minifier removes

**CSS mode**

- Removes `/* ... */` comments.
- Collapses all whitespace to single spaces, then removes spaces around `{ } : ; , > + ~`.
- Drops the last semicolon before a closing brace.

**JavaScript mode**

- Removes `/* ... */` comments and lines that start with `//`.
- Collapses whitespace and removes spaces around brackets, operators and punctuation.

Example in CSS mode:

```
.card {
  padding: 16px;
  margin: 0 auto;
}
```

becomes `.card{padding:16px;margin:0 auto}`.

## Limitations to check before using the output

- The tool uses simple text patterns, not a code parser. It does not rename variables or shorten values.
- In JavaScript, a `//` comment at the end of a line of code is not removed. Because line breaks are removed too, it can comment out the code after it.
- Code that relies on line breaks instead of semicolons may break once lines are joined.
- Spaces inside strings and template literals are also collapsed.
- In CSS, spaces around `+` are removed, which breaks `calc()` expressions such as `calc(100% + 10px)`.

Always test the minified code before using it.

## Frequently asked questions

### Is my code uploaded?

No. Minifying runs in your browser. The optional **Save to history** button keeps recent snippets in this browser only (local storage), on your own device.

### Can I use it for production builds?

For large apps, use your normal build pipeline. This tool is best for short snippets and quick tests.
