Developer
Minification
Minification removes every byte a machine does not need — whitespace, line breaks, comments and long names — from code or data without changing what it does.
Updated 12 Aug 2026
Smaller output, identical behaviour
Source code and formatted data contain a lot of characters that exist purely for human readers. Minification strips them: indentation, newlines, comments and — in JavaScript — long local variable names, which a minifier can safely shorten because nothing outside the function can see them.
Minification is not compression
| Minification | Compression (gzip/brotli) | |
|---|---|---|
| Works on | Source text | Any bytes |
| Result | Still valid, readable-ish code | Binary, must be decompressed |
| Applied | At build time | In transit by the server |
| Combine? | Yes — minify first, then compress | Yes |
The two stack: minifying before gzip typically yields a smaller payload than either alone, because the minifier removes patterns the compressor would otherwise have to encode.
When to minify JSON
- API responses and anything sent over the network — always
- Files committed to version control — no, diffs become unreadable
- Configuration a person edits — no, keep it formatted
- Large payloads stored in a database column — usually yes
JSON Formatter
Switch between compact and readable output with one click.
Characteristics
- Removes whitespace, newlines and comments
- Preserves exact behaviour and, for data, exact values
- Reversible for JSON, only partly reversible for code
- Commonly paired with source maps for debugging
Common uses
- Shrinking JavaScript and CSS bundles for production
- Compacting API payloads
- Reducing storage for logs and cached documents
- Fitting data into size-limited fields or query strings
Advantages
- Meaningfully smaller payloads and faster page loads
- Compounds with gzip or brotli compression
- No behavioural change when done by a correct tool
- Automated as a build step, so it costs nothing ongoing
Limitations
- Minified output is hard to read or debug without source maps
- Produces unreadable diffs if committed to a repository
- Gains are marginal for small files
- Aggressive code minification can break reflection-based logic
Examples
{
"id": 4821,
"roles": ["admin", "editor"]
}
{"id":4821,"roles":["admin","editor"]}Frequently asked questions
What is minification used for?
Reducing the size of code and data so pages load faster and payloads cost less to transfer.
Is minification the same as compression?
No. Minification rewrites the source; compression encodes bytes for transit. Use both.
Does minified JSON parse faster?
Slightly, but the real gain is a smaller download rather than parse speed.
Can minification be undone?
JSON can be beautified back exactly. Code can be reformatted, but original names and comments are gone.
Should I commit minified files?
No. Generate them at build time and keep readable sources in version control.
Related terms
JSON
JSON is a lightweight text-based data format commonly used to exchange structured data between applications and APIs.
Image Compression
Image compression reduces the byte size of a picture by removing redundant or visually unimportant data, either losslessly or by discarding detail the eye barely notices.
PDF Compression
PDF compression reduces the file size of a PDF by re-encoding its images, removing redundant objects and compressing content streams, ideally without visible loss of quality.
URL Encoding
URL encoding, also called percent-encoding, replaces characters that have a special meaning or are unsafe in a URL with a percent sign followed by their hexadecimal byte value.
Base64
Base64 is an encoding scheme that represents binary data using 64 printable ASCII characters so it can travel safely through text-only channels.
Character Encoding
Character encoding is the mapping between the characters people read and the bytes computers store, defining how text is turned into binary and back again.
Related tools
Related guides
How to Format JSON (Beautify, Indent and Minify)
Learn how JSON formatting works, see a before-and-after example, fix the errors that block beautifying, and format JSON online in your browser without uploading a file.
JSON vs XML: Which Format Should You Use?
A practical JSON vs XML comparison: syntax, size, parsing speed, schemas, comments, attributes and metadata — plus clear guidance on which format fits which job.
URL Encoding Explained (Percent-Encoding)
Why URLs need encoding, which characters are reserved, the difference between encodeURI and encodeURIComponent, plus and space confusion, and how to avoid double encoding.
What Is JSON? A Plain-English Guide
JSON explained without jargon: what it is, how the syntax works, which data types it supports, where it is used and how it differs from JavaScript objects.