# Minification

> Making code smaller. It cuts spaces, notes and long names, and the code still works.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** Minify, Minifier, Code Minification

## Think of it like

Think of it like squeezing the air out of a bag of clothes. Same clothes, much smaller bag.

## Definition

Minification makes code files smaller. It removes all the things the computer does not need. It strips spaces, line breaks and comments, and it swaps long names for one letter. The code still runs the same, but it is hard for people to read. Smaller files download faster, which matters most on phones. Build tools minify JavaScript and CSS before a site goes live.

## Example

Jack's 180 KB script shrinks to 60 KB once it is minified. The page loads much faster on a phone.

## Example code

```javascript
// before
function addNumbers(first, second) {
  return first + second;
}
// after
function a(n,r){return n+r}
```

Same function, a fraction of the size.

## Why it matters

Each byte has to travel to each visitor. Making files smaller is free speed.

## Common mistake

Trying to debug the minified file. Use a source map to see the original code instead.

## Three principles

- **Strip the extras.** Spaces, comments, long names.
- **Same behaviour.** It runs exactly the same.
- **Smaller downloads.** Faster pages, mostly on phones.

## Related terms

- [JavaScript Bundler](https://learn.benibix.com/term/development/bundler)
- [Source Map](https://learn.benibix.com/term/development/source-map)
- [Tree Shaking](https://learn.benibix.com/term/development/tree-shaking)
- [JavaScript](https://learn.benibix.com/term/development/javascript)

## Told apart from

- [Minification vs Tree Shaking](https://learn.benibix.com/compare/minification-vs-tree-shaking): Both make code files smaller. Minification squeezes code by cutting spaces and long names. Tree shaking drops whole parts of code that are never used.

---

Source: https://learn.benibix.com/term/development/minification
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
