Skip to content

πŸƒβ€β™‚οΈπŸƒβ€β™€οΈπŸƒ JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify

License

Notifications You must be signed in to change notification settings

privatenumber/minification-benchmarks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7b90e15 Β· Apr 2, 2025
Mar 15, 2025
Oct 7, 2023
Apr 8, 2024
Apr 2, 2025
Dec 11, 2020
Mar 15, 2024
Jun 7, 2024
Dec 11, 2020
Apr 2, 2025
Jun 7, 2024
Apr 2, 2025
Apr 7, 2024
Feb 10, 2025
Apr 7, 2024

Repository files navigation

minification benchmarks

What's the best JavaScript minifier?

This project benchmarks the following minifiers:

Minifier Version Release date ↓
oxc-minify 0.62.0 2025-04-02
@swc/core 1.11.16 2025-04-01
bun 1.2.8 2025-03-31
esbuild 0.25.2 2025-03-30
@tdewolff/minify 2.22.4 2025-03-25
terser 5.39.0 2025-02-13
uglify-js 3.19.3 2024-08-29
google-closure-compiler 20240317.0.0 2024-03-19
babel-minify 0.5.2 2022-05-06
tedivm/jshrink 1.7.0

Benchmarks last updated on Apr 2, 2025.


πŸ™‹β€β™‚οΈ Why?

  1. To help you pick a minifier that fits your needs
  2. To promote JS minifiers and document their performances
  3. To encourage healthy competition and improvement amongst minifiers

πŸ‘Ÿ Methodology

  • Each minifier is executed in its own process with a 10s timeout
  • Artifact integrity is verified by a test before and after minification
  • Each minifier is minimally configured (sourcemaps & comments disabled), comparing out-of-the-box experience
  • Minifier upgrade PRs are automated via WhiteSource Renovate
  • Benchmarks are updated on every PR via GitHub Actions
  • The raw benchmark data is available in /packages/data/data/data.json

⏱ Metrics

Minifiers are ranked by smallest minzipped size.

Minified size

Size of the minified output.

Minzipped size

Size of the minified output with Gzip compression.

For minifiers, this measures how compressable the output is.

For users, this measures network transfer size, which is usually the metric that matters most.

Time

How long minification took (average of 5 runs). Each time is annotated with a multiplier relative to the fastest minifier.

πŸ“‹ Results

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "react v17.0.2"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11,12]
	y-axis "Gzip size" 0 --> 19385
	bar [19385,8177,8186,8193,8265,8448,8493,8543,8628,8661,8668,8746,11040]
Artifact Original size Gzip size
react v17.0.2 (Source) 72.13 kB 19.39 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-69% 22.64 kB πŸ†-58% 8.18 kB 205x 497 ms
2. @swc/core -68% 22.81 kB -58% 8.19 kB 6x 16 ms
3. google-closure-compiler -68% 22.83 kB -58% 8.19 kB 1268x 3,070 ms
4. terser -68% 23.07 kB -57% 8.27 kB 113x 275 ms
5. babel-minify -67% 23.60 kB -56% 8.45 kB 267x 647 ms
6. oxc-minify -67% 23.52 kB -56% 8.49 kB 1x 3 ms
7. esbuild -67% 23.70 kB -56% 8.54 kB 5x 14 ms
8. @tdewolff/minify -67% 23.49 kB -55% 8.63 kB πŸ† 2 ms
9. bun -67% 23.99 kB -55% 8.66 kB 6x 15 ms
10. uglify-js (no compress) -65% 25.03 kB -55% 8.67 kB 37x 91 ms
11. terser (no compress) -65% 25.08 kB -55% 8.75 kB 48x 118 ms
12. tedivm/jshrink -43% 40.82 kB -43% 11.04 kB 50x 123 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "moment v2.29.1"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11,12]
	y-axis "Gzip size" 0 --> 36231
	bar [36231,18568,18690,18748,18910,19119,19260,19334,19478,19569,19683,19857,24998]
Artifact Original size Gzip size
moment v2.29.1 (Source) 173.90 kB 36.23 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-67% 57.73 kB πŸ†-49% 18.57 kB 156x 1,149 ms
2. terser -66% 59.14 kB -48% 18.69 kB 90x 668 ms
3. @swc/core -66% 58.43 kB -48% 18.75 kB 5x 43 ms
4. google-closure-compiler -66% 58.27 kB -48% 18.91 kB 511x 3,753 ms
5. babel-minify -66% 59.70 kB -47% 19.12 kB 199x 1,465 ms
6. oxc-minify -66% 59.52 kB -47% 19.26 kB 1x 8 ms
7. esbuild -66% 59.82 kB -47% 19.33 kB 3x 23 ms
8. @tdewolff/minify -66% 59.87 kB -46% 19.48 kB πŸ† 7 ms
9. uglify-js (no compress) -64% 62.50 kB -46% 19.57 kB 29x 215 ms
10. terser (no compress) -64% 63.15 kB -46% 19.68 kB 36x 270 ms
11. bun -64% 61.84 kB -45% 19.86 kB 2x 19 ms
12. tedivm/jshrink -44% 97.63 kB -31% 25.00 kB 38x 282 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "jquery v3.5.1"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11,12]
	y-axis "Gzip size" 0 --> 84498
	bar [84498,30866,30903,30912,30970,31446,31470,31621,31799,31954,32653,33086,40879]
Artifact Original size Gzip size
jquery v3.5.1 (Source) 287.63 kB 84.50 kB
Minifier Minified size Minzipped size Time
1. @swc/core -69% 89.17 kB πŸ†-63% 30.87 kB 7x 66 ms
2. uglify-js πŸ†-69% 88.45 kB -63% 30.90 kB 186x 1,593 ms
3. terser -69% 89.54 kB -63% 30.91 kB 104x 891 ms
4. oxc-minify -69% 89.33 kB -63% 30.97 kB 1x 13 ms
5. @tdewolff/minify -69% 89.68 kB -63% 31.45 kB πŸ† 9 ms
6. uglify-js (no compress) -67% 94.08 kB -63% 31.47 kB 36x 314 ms
7. terser (no compress) -67% 94.55 kB -63% 31.62 kB 41x 353 ms
8. babel-minify -68% 92.10 kB -62% 31.80 kB 280x 2,398 ms
9. esbuild -69% 90.07 kB -62% 31.95 kB 4x 36 ms
10. bun -68% 92.55 kB -61% 32.65 kB 3x 28 ms
11. google-closure-compiler -68% 92.70 kB -61% 33.09 kB 474x 4,056 ms
12. tedivm/jshrink -50% 144.14 kB -52% 40.88 kB 42x 363 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "vue v2.6.12"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11,12]
	y-axis "Gzip size" 0 --> 89668
	bar [89668,42727,42919,43036,43358,43925,44230,44354,44368,44450,44679,45400,57169]
Artifact Original size Gzip size
vue v2.6.12 (Source) 342.15 kB 89.67 kB
Minifier Minified size Minzipped size Time
1. @swc/core -66% 115.70 kB πŸ†-52% 42.73 kB 6x 92 ms
2. terser -66% 116.80 kB -52% 42.92 kB 77x 1,102 ms
3. uglify-js πŸ†-67% 113.80 kB -52% 43.04 kB 154x 2,206 ms
4. oxc-minify -66% 117.25 kB -52% 43.36 kB 1x 17 ms
5. babel-minify -66% 117.90 kB -51% 43.93 kB 189x 2,696 ms
6. google-closure-compiler -66% 115.61 kB -51% 44.23 kB 329x 4,686 ms
7. @tdewolff/minify -66% 117.67 kB -51% 44.35 kB πŸ† 14 ms
8. esbuild -65% 118.14 kB -51% 44.37 kB 3x 43 ms
9. uglify-js (no compress) -63% 126.14 kB -50% 44.45 kB 25x 364 ms
10. terser (no compress) -63% 126.58 kB -50% 44.68 kB 31x 443 ms
11. bun -64% 121.50 kB -49% 45.40 kB 2x 32 ms
12. tedivm/jshrink -42% 197.36 kB -36% 57.17 kB 33x 479 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "lodash v4.17.21"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11,12]
	y-axis "Gzip size" 0 --> 96690
	bar [96690,24686,24972,25186,25240,25503,25862,25979,26200,26221,26498,26655,36327]
Artifact Original size Gzip size
lodash v4.17.21 (Source) 544.09 kB 96.69 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-87% 68.17 kB πŸ†-74% 24.69 kB 140x 1,689 ms
2. google-closure-compiler -86% 73.47 kB -74% 24.97 kB 367x 4,402 ms
3. terser -87% 70.67 kB -74% 25.19 kB 78x 947 ms
4. @swc/core -87% 69.82 kB -74% 25.24 kB 6x 76 ms
5. babel-minify -87% 72.37 kB -74% 25.50 kB 173x 2,083 ms
6. uglify-js (no compress) -86% 74.61 kB -73% 25.86 kB 27x 333 ms
7. oxc-minify -87% 71.38 kB -73% 25.98 kB πŸ† 12 ms
8. esbuild -87% 72.48 kB -73% 26.20 kB 2x 35 ms
9. terser (no compress) -86% 75.29 kB -73% 26.22 kB 31x 377 ms
10. @tdewolff/minify -87% 71.90 kB -73% 26.50 kB 1x 14 ms
11. bun -87% 73.45 kB -72% 26.66 kB 2x 25 ms
12. tedivm/jshrink -73% 148.78 kB -62% 36.33 kB 30x 365 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "d3 v6.3.1"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10]
	y-axis "Gzip size" 0 --> 130686
	bar [130686,87016,87208,88087,88162,88319,89156,89882,90800,92395,94121]
Artifact Original size Gzip size
d3 v6.3.1 (Source) 555.77 kB 130.69 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-53% 263.56 kB πŸ†-33% 87.02 kB 118x 3,927 ms
2. @swc/core -52% 265.22 kB -33% 87.21 kB 6x 219 ms
3. terser -52% 267.77 kB -33% 88.09 kB 68x 2,274 ms
4. oxc-minify -51% 270.84 kB -33% 88.16 kB 1x 44 ms
5. uglify-js (no compress) -50% 275.35 kB -32% 88.32 kB 21x 711 ms
6. terser (no compress) -50% 276.47 kB -32% 89.16 kB 30x 1,011 ms
7. @tdewolff/minify -52% 269.35 kB -31% 89.88 kB πŸ† 33 ms
8. esbuild -51% 270.13 kB -31% 90.80 kB 2x 69 ms
9. bun -51% 273.41 kB -29% 92.40 kB 1x 48 ms
10. google-closure-compiler -51% 270.30 kB -28% 94.12 kB 213x 7,048 ms
11. babel-minify ❌ Minification ❌ ❌ -
12. tedivm/jshrink ❌ Minification ❌ ❌ -

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "terser v5.30.3"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 193763
	bar [193763,122362,123291,123334,123482,124428,124609,124878,126562,126707,127653,145178]
Artifact Original size Gzip size
terser v5.30.3 (Source) 1.01 MB 193.76 kB
Minifier Minified size Minzipped size Time
1. oxc-minify -56% 440.17 kB πŸ†-37% 122.36 kB 1x 45 ms
2. @swc/core -55% 455.63 kB -36% 123.29 kB 5x 190 ms
3. uglify-js -55% 451.19 kB -36% 123.33 kB 110x 3,787 ms
4. terser -55% 458.29 kB -36% 123.48 kB 63x 2,172 ms
5. terser (no compress) -53% 474.40 kB -36% 124.43 kB 28x 967 ms
6. uglify-js (no compress) -53% 472.16 kB -36% 124.61 kB 22x 778 ms
7. @tdewolff/minify -55% 456.58 kB -36% 124.88 kB πŸ† 34 ms
8. google-closure-compiler πŸ†-56% 439.95 kB -35% 126.56 kB 192x 6,579 ms
9. esbuild -55% 458.89 kB -35% 126.71 kB 1x 63 ms
10. bun -54% 466.80 kB -34% 127.65 kB 1x 42 ms
11. tedivm/jshrink -37% 633.71 kB -25% 145.18 kB 39x 1,341 ms
12. babel-minify ❌ Minification ❌ ❌ -

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "three v0.124.0"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 248267
	bar [248267,158768,159071,159198,160829,162998,163036,163198,163725,164610,166210,193471]
Artifact Original size Gzip size
three v0.124.0 (Source) 1.25 MB 248.27 kB
Minifier Minified size Minzipped size Time
1. @swc/core -48% 643.07 kB πŸ†-36% 158.77 kB 6x 319 ms
2. uglify-js πŸ†-49% 641.59 kB -36% 159.07 kB 95x 5,046 ms
3. terser -48% 653.25 kB -36% 159.20 kB 55x 2,934 ms
4. oxc-minify -48% 647.00 kB -35% 160.83 kB 1x 70 ms
5. google-closure-compiler -48% 644.45 kB -34% 163.00 kB 163x 8,569 ms
6. uglify-js (no compress) -46% 674.49 kB -34% 163.04 kB 18x 994 ms
7. terser (no compress) -46% 675.50 kB -34% 163.20 kB 24x 1,287 ms
8. esbuild -48% 646.76 kB -34% 163.73 kB 1x 91 ms
9. @tdewolff/minify -48% 642.46 kB -34% 164.61 kB πŸ† 53 ms
10. bun -47% 655.93 kB -33% 166.21 kB 1x 57 ms
11. tedivm/jshrink -24% 952.01 kB -22% 193.47 kB 32x 1,715 ms
12. babel-minify ❌ Timed out - - ⚠️ +10,000 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "victory v35.8.4"
	x-axis ["Original",1,2,3,4,5,6,7,8,9]
	y-axis "Gzip size" 0 --> 309942
	bar [309942,157435,157848,158706,162262,165014,166386,167579,181071,182671]
Artifact Original size Gzip size
victory v35.8.4 (Source) 2.13 MB 309.94 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-67% 694.78 kB πŸ†-49% 157.44 kB 118x 6,579 ms
2. @swc/core -67% 706.21 kB -49% 157.85 kB 8x 467 ms
3. terser -66% 715.58 kB -49% 158.71 kB 71x 3,977 ms
4. oxc-minify -66% 716.14 kB -48% 162.26 kB 1x 102 ms
5. @tdewolff/minify -66% 717.07 kB -47% 165.01 kB πŸ† 56 ms
6. terser (no compress) -64% 759.34 kB -46% 166.39 kB 28x 1,606 ms
7. uglify-js (no compress) -65% 756.53 kB -46% 167.58 kB 23x 1,314 ms
8. esbuild -66% 724.14 kB -42% 181.07 kB 2x 125 ms
9. bun -66% 727.90 kB -41% 182.67 kB 1x 80 ms
10. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
11. babel-minify ❌ Minification ❌ ❌ -
12. tedivm/jshrink ❌ Post-validation ❌ ❌ -

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "echarts v5.1.1"
	x-axis ["Original",1,2,3,4,5,6,7,8]
	y-axis "Gzip size" 0 --> 684611
	bar [684611,321265,321987,324635,330736,331412,331563,331847,337934]
Artifact Original size Gzip size
echarts v5.1.1 (Source) 3.20 MB 684.61 kB
Minifier Minified size Minzipped size Time
1. @swc/core πŸ†-69% 994.56 kB πŸ†-53% 321.27 kB 7x 824 ms
2. terser -69% 1.00 MB -53% 321.99 kB 51x 6,005 ms
3. oxc-minify -69% 1.01 MB -53% 324.64 kB 1x 180 ms
4. terser (no compress) -66% 1.07 MB -52% 330.74 kB 22x 2,649 ms
5. uglify-js (no compress) -67% 1.07 MB -52% 331.41 kB 14x 1,756 ms
6. esbuild -68% 1.01 MB -52% 331.56 kB 1x 192 ms
7. @tdewolff/minify -68% 1.01 MB -52% 331.85 kB πŸ† 118 ms
8. bun -68% 1.02 MB -51% 337.93 kB 1x 132 ms
9. babel-minify ❌ Timed out - - ⚠️ +10,000 ms
10. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
11. uglify-js ❌ Timed out - - ⚠️ +10,000 ms
12. tedivm/jshrink ❌ Minification ❌ ❌ -

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "antd v4.16.1"
	x-axis ["Original",1,2,3,4,5,6,7,8]
	y-axis "Gzip size" 0 --> 825175
	bar [825175,452478,457786,463334,471730,475480,478572,488279,491833]
Artifact Original size Gzip size
antd v4.16.1 (Source) 6.67 MB 825.18 kB
Minifier Minified size Minzipped size Time
1. @swc/core πŸ†-68% 2.15 MB πŸ†-45% 452.48 kB 8x 1,216 ms
2. terser -66% 2.25 MB -45% 457.79 kB 48x 6,823 ms
3. oxc-minify -66% 2.28 MB -44% 463.33 kB 1x 237 ms
4. @tdewolff/minify -66% 2.29 MB -43% 471.73 kB πŸ† 140 ms
5. terser (no compress) -64% 2.43 MB -42% 475.48 kB 22x 3,111 ms
6. uglify-js (no compress) -64% 2.42 MB -42% 478.57 kB 18x 2,525 ms
7. esbuild -65% 2.31 MB -41% 488.28 kB 2x 304 ms
8. bun -66% 2.30 MB -40% 491.83 kB 1x 182 ms
9. babel-minify ❌ Timed out - - ⚠️ +10,000 ms
10. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
11. tedivm/jshrink ❌ Timed out - - ⚠️ +10,000 ms
12. uglify-js ❌ Timed out - - ⚠️ +10,000 ms

Loading
---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "typescript v4.9.5"
	x-axis ["Original",1,2,3,4,5,6]
	y-axis "Gzip size" 0 --> 1884998
	bar [1884998,859210,860670,875806,876535,879301,915551]
Artifact Original size Gzip size
typescript v4.9.5 (Source) 10.95 MB 1.88 MB
Minifier Minified size Minzipped size Time
1. @swc/core πŸ†-70% 3.31 MB πŸ†-54% 859.21 kB 8x 2,205 ms
2. oxc-minify -69% 3.35 MB -54% 860.67 kB 1x 450 ms
3. @tdewolff/minify -69% 3.35 MB -54% 875.81 kB πŸ† 263 ms
4. uglify-js (no compress) -68% 3.54 MB -53% 876.54 kB 15x 4,029 ms
5. terser (no compress) -68% 3.53 MB -53% 879.30 kB 20x 5,318 ms
6. esbuild -68% 3.49 MB -51% 915.55 kB 1x 490 ms
7. terser ❌ Timed out - - ⚠️ +10,000 ms
8. babel-minify ❌ Timed out - - ⚠️ +10,000 ms
9. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
10. uglify-js ❌ Timed out - - ⚠️ +10,000 ms
11. tedivm/jshrink ❌ Timed out - - ⚠️ +10,000 ms
12. bun ❌ Post-validation ❌ ❌ -

βš”οΈ Minifier showdown

Note

πŸ€– This analysis is AI generated

The minification showdown is settled! JavaScript minifiers battled it out in terms of compression ratios and blazing speeds. It’s time to declare the standout performers and crown the most impressive competitor. Let's break it down!

Best minifier

@swc/core takes the championship title! With a dazzling combination of the smallest gzip sizes on large codebases and lightning-fast processing times, it consistently topped critical rounds like "echarts" (47% reduction in 824 ms) and "antd" (55% reduction in 1,216 ms). Its performance remained exceptional across the board, providing reliability and efficiency for the average user.

For those who value size most, @swc/core is king. Its speed means no trade-off for projects of any scale, making it a universal pick for most scenarios.

Honorable mentions

  • uglify-js: Our long-time veteran finished strong in size, regularly achieving the smallest gzip artifacts (e.g., "lodash" with 26% at 24.69 kB). However, its enormous processing time (e.g., over 6 seconds for "victory") makes it unwieldy in modern workflows.

  • oxc-minify: A rising star! Its minification speed is nearly unrivaled, and sizes are competitive. For instance, it nailed "typescript" with 860.67 kB output in just 450 ms. Perfect for when speed is crucial.

  • @tdewolff/minify: The sprinter that takes speed to new levels. Frequently the fastest in the pack, like the "react" round at an incredible 2 ms. Results were slightly larger, so it’s best suited for cases where time is money.

  • terser: A respectable contender for balanced size and speed. While not the leader in either category, this dependable all-rounder may appeal to fans of its rich AST manipulation features.

Eliminated

  • babel-minify: A fatal runtime error in "d3" disqualified it. Compatibility issues could lead to corrupted results.

  • tedivm/jshrink: Similarly tripped up in "d3" and failed to handle intricate regular expressions. Its specialized use cases are not suitable for complex minifications.

  • bun: Received a red card for failing post-validation in "typescript," outputting invalid code. Careful testing would be required before adoption.

The race was thrilling, and the participants gave it their all! Congratulations to all the contenders who made it through the roundsβ€”each has a niche and excels under the right conditions. Still, @swc/core swept this competition with grace, size optimization, and speed aplomb. Which tool will you adopt for your next project?

Sponsors