# Code Minifier — Minify JSON, HTML, CSS, and JavaScript

> Minify JSON, HTML, CSS, or JavaScript locally in your browser. Remove unnecessary whitespace and comments without uploading code.

Source: https://toolpantry.app/minify-tool

## About

Remove comments and unnecessary whitespace from JSON, HTML, CSS, or JavaScript locally before you paste it into a project or CMS.

## Quick answer

**How do I minify CSS or JavaScript?** Paste your code and get the minified version with the size savings shown — all locally.

## How to minify JSON, HTML, CSS, or JavaScript

1. **Paste your code** — pick the language.
2. **Minify** — whitespace and comments are stripped, size stats shown.
3. **Copy or download** — and always test the minified output before shipping it.

## When minifying pays

- Shaving kilobytes off an inline snippet
- Preparing a small JS file for a static deploy
- Seeing how much of a file is just whitespace

## Good to know

Minification is not optimization — it does not remove dead code or rename variables, it only compresses syntax. JavaScript is the risky one: missing semicolons at line boundaries can change behavior after joining lines, so test the result, and keep the readable source as the source of truth. Related: [formatter](https://toolpantry.app/html-formatter) (the reverse trip).

## Notes

JSON is parsed and re-serialized. HTML, CSS, and JavaScript use lightweight browser-safe minification; review output in your build or test process before publishing.

## FAQ

**Will my code leave this page?**

No. The minifier operates on the text in this browser tab and creates no server request.

**Why did JSON show an error?**

JSON must be valid before it can be minified. Check commas, quotes, braces, and trailing commas.
