Choose a version:
41% The original file has 123765 bytes (120.9k) and is available from the project website.
There you can find the official minified version, too, which brings down the size to 51039 bytes (49.8k, 41%).

After GZIP compression these minified files vary in size:
cdnjs
  14199 bytes (13.9k)
CDN
gzip -6 (default)
  14113 bytes (13.8k)
local copy
MaxCDN
  14090 bytes (13.8k)
CDN
gzip -9
  14061 bytes (13.7k)
local copy
unpkg
  14028 bytes (13.7k)
CDN
libdeflate -12
  13609 bytes (13.3k)
local copy
7zip -mx=9 -tgzip
  13605 bytes (13.3k)
local copy
pigz -11 -n
  13530 bytes (13.2k)
local copy
kzip -s0 -rn -b3
  13529 bytes (13.2k)
local copy
Zopfli
  13496 bytes (13.2k)
local copy
Zopfli (defluff)
  13495 bytes (13.2k)
local copy

perma-link to the smallest file on my server:
http://minime.stephan-brumme.com/files/bootstrap/bootstrap-4.1.2.min.js (or via HTTPS)

You will automatically get the smallest Bootstrap 4.1.2 file, ETag caching is available and
if your browser doesn't support GZIP decompression then the uncompressed version will be sent.

Currently best Zopfli settings

Save 532 bytes by using my Bootstrap 4.1.2 Zopfli version instead of the best available CDN (3.94% smaller than unpkg, 13496 vs. 14028 bytes):
You can use my super-compressed files for whatever purpose you like as long as you respect the library's original license agreement.
There are no restrictions from my side - but please avoid hot-linking if you run a high-traffic website.

These command-line settings yielded the best compression ratio so far (Linux version of zopfli-krzymod):
zopfli --i100000 --mb8 --mls32 --bsr17 --lazy --ohh

(found July 13, 2018)
Description Value Parameter
iterations 100000  --i100000
maximum blocks 8  --mb8
maximum length score 32  --mls32
block splitting recursion 17  --bsr17
lazy matching in LZ77 yes  --lazy
optimized Huffman headers yes  --ohh
initial random W for iterations 1  --rw1
initial random Z for iterations 2  --rz2

Even Smaller Files Thanks To Defluff

Zopfli's output can be further optimized by the defluff tool.
In this particular case, defluff saves 1 more byte (13495 bytes).

Verify file integrity

After decompression, my uncompressed files are identical to the original ones:

MD5:
curl --silent --compressed https://raw.githubusercontent.com/twbs/bootstrap/v4.1.2/dist/js/bootstrap.min.js --location | md5sum
f92a3f337500984fbd20487501257dae  -
curl --silent --compressed https://minime.stephan-brumme.com/files/bootstrap/bootstrap-4.1.2.min.zopfli.js.gz | md5sum
f92a3f337500984fbd20487501257dae  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/twbs/bootstrap/v4.1.2/dist/js/bootstrap.min.js --location | sha1sum
6188ea651648c61ff3107c9d9a2b03a896972955  -
curl --silent --compressed https://minime.stephan-brumme.com/files/bootstrap/bootstrap-4.1.2.min.zopfli.js.gz | sha1sum
6188ea651648c61ff3107c9d9a2b03a896972955  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
cdnjs 14199 bytes f92a3f337500984fbd20487501257dae (invalid)
MaxCDN 14090 bytes f92a3f337500984fbd20487501257dae (invalid)
unpkg 14028 bytes f92a3f337500984fbd20487501257dae (invalid)

Note: only the MD5 hashes are shown to keep things simple.

Other Versions

Available Bootstrap versions at minime.stephan-brumme.com:

4.1.3, 4.1.2, 4.1.1, 4.1.0,
4.0.0,
3.3.7, 3.3.6, 3.3.5, 3.3.4, 3.3.2, 3.3.1, 3.3.0,
3.2.0,
3.1.1, 3.1.0,
3.0.3, 3.0.2, 3.0.1, 3.0.0

The project site contains an overview how well these versions were compressed.
Other interesting projects are AngularJS, BackboneJS, D3, Dojo, Ember, jQuery, Knockout, lodash, React, Socket.IO, ThreeJS, UnderscoreJS and Vue.

Changelog

Best Zopfli parameters so far:
Size Improvement Parameters Found
13496 bytes -1 byte zopfli --i100000 --mls32 --bsr17 --lazy --ohh July 13, 2018 @ 18:00
13497 bytes -1 byte zopfli --i100000 --mls32 --bsr14 --lazy --ohh July 13, 2018 @ 16:54
13498 bytes -1 byte zopfli --i10000 --mls32 --bsr30 --lazy --ohh July 13, 2018 @ 16:29
13499 bytes -1 byte zopfli --i1000 --mls32 --bsr10 --lazy --ohh July 13, 2018 @ 16:27
13500 bytes -1 byte zopfli --i1000 --mls32 --bsr14 --lazy --ohh July 13, 2018 @ 16:26
13501 bytes -1 byte zopfli --i1000 --mls16 --bsr9 --lazy --ohh July 13, 2018 @ 16:26
13502 bytes -1 byte zopfli --i1000 --mls4 --bsr8 --lazy --ohh July 13, 2018 @ 16:26
13503 bytes -1 byte zopfli --i1000 --mls4 --bsr11 --lazy --ohh July 13, 2018 @ 16:25
13504 bytes zopfli --i100 --mls2 --bsr10 --lazy --ohh July 13, 2018 @ 16:23

If there are multiple parameter sets yielding the same compressed size, only the first one found is shown.

Most recent activity on July 13, 2018 @ 21:12.

Heatmaps

This Zopfli heatmap visualizes how compression changes when modifying the --bsr and --mls parameter.
Cell's contents is the best filesize achieved (in bytes, hover with mouse over cells to see number of iterations).

Good parameters are green, bad are red. The best and worst are bold as well.
The brightness of the blue background color indicates how many iterations were processed:
10,000, 100,000 or 1,000,000.
bsr \ mls
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
bsr \ mls
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
13562 13562 13521 13561 13519 13535 13535 13520 13528 13542 13541 13529 13551 13524 13544
13550 13551 13522 13503 13522 13522 13519 13512 13500 13515 13558 13553 13523 13532 13532
13501 13502 13512 13500 13500 13521 13512 13511 13497 13528 13516 13515 13538 13525 13514
13501 13501 13521 13503 13503 13512 13508 13510 13511 13511 13510 13526 13546 13515 13515
13500 13500 13522 13508 13510 13523 13510 13511 13520 13522 13511 13557 13558 13528 13528
13510 13510 13513 13498 13500 13522 13510 13516 13509 13521 13529 13551 13513 13513 13519
13498 13501 13521 13497 13498 13520 13510 13511 13510 13521 13511 13553 13544 13515 13516
13498 13501 13522 13511 13510 13521 13510 13510 13514 13521 13519 13511 13541 13511 13512
13510 13510 13523 13503 13510 13512 13510 13501 13509 13521 13511 13532 13532 13533 13516
13512 13503 13522 13511 13512 13522 13510 13511 13512 13521 13511 13557 13547 13527 13511
13510 13510 13525 13509 13497 13510 13507 13514 13515 13521 13550 13558 13540 13527 13528
13500 13500 13522 13503 13497 13521 13507 13510 13515 13510 13510 13520 13560 13531 13534
13510 13510 13521 13510 13510 13521 13510 13513 13513 13521 13511 13529 13540 13515 13513
13502 13502 13512 13503 13496 13509 13499 13500 13500 13512 13519 13511 13538 13529 13518
13501 13501 13521 13510 13510 13521 13510 13501 13500 13510 13509 13554 13543 13529 13530
13508 13508 13521 13509 13510 13521 13511 13511 13512 13521 13511 13554 13536 13515 13515
13501 13501 13514 13503 13497 13509 13520 13501 13498 13512 13510 13558 13540 13514 13514
13510 13510 13522 13509 13510 13522 13511 13500 13509 13520 13510 13510 13536 13515 13515
13503 13502 13522 13511 13512 13521 13514 13512 13513 13522 13510 13514 13542 13530 13530
13500 13500 13517 13498 13501 13522 13510 13512 13500 13510 13520 13519 13545 13540 13529
13510 13510 13522 13515 13514 13510 13510 13503 13500 13512 13511 13558 13543 13514 13514
13501 13501 13513 13502 13497 13511 13510 13511 13512 13521 13552 13554 13528 13527 13514
13500 13500 13522 13500 13509 13522 13510 13510 13510 13520 13510 13535 13541 13532 13530

Due to the Monte Carlo design of my search algorithm, not all parameters have reached the same number of iterations yet:
Iterations Min. Bytes Reduction Coverage
100 13504 bytes 100%
1,000 13499 bytes -5 bytes 100%
10,000 13498 bytes -1 byte 100%
100,000 13496 bytes -2 bytes 4.06%
1,000,000 13496 bytes 0.29%
10,000,000

KZIP has far less options available for tuning/optimization. I only played around with the number of blocks (parameter -n):
Blocks Min. Bytes Compared To Best Zopfli Compared To Best KZIP
13633 bytes +137 bytes (+1.02%) +104 bytes
13634 bytes +138 bytes (+1.02%) +105 bytes
13571 bytes +75 bytes (+0.56%) +42 bytes
13529 bytes +33 bytes (+0.24%)
13542 bytes +46 bytes (+0.34%) +13 bytes
13560 bytes +64 bytes (+0.47%) +31 bytes
13598 bytes +102 bytes (+0.76%) +69 bytes
13623 bytes +127 bytes (+0.94%) +94 bytes
13663 bytes +167 bytes (+1.24%) +134 bytes

Non-DEFLATE Algorithms

Archivers based on completely different compression algorithms often produce superior results.
Unfortunately, browsers only support gzip compression at the moment.
Algorithm Program Parameters Size Compared To Best Zopfli
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 11438 bytes -2058 bytes (-15.25%)
ZPAQ (Wikipedia) zpaq zpaq -method 69 11691 bytes -1805 bytes (-13.37%)
Brotli (Wikipedia) brotli brotli -q 11 12242 bytes -1254 bytes (-9.29%)
LZMA2 (Wikipedia) xz xz -9 13076 bytes -420 bytes (-3.11%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 13252 bytes -244 bytes (-1.81%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 13267 bytes -229 bytes (-1.70%)
Zstandard (Wikipedia) zstd zstd -19 13300 bytes -196 bytes (-1.45%)

Detailled Analysis

I wrote a DEFLATE decoder in Javascript. Click the button below to start a client-side analysis of the smallest gzipped files (may take a second):


Notes: pigz is a fast open source multi-threaded implementation of gzip written by one of the original authors of gzip.
However, when using compression level 11, pigz actually switches to the slower Zopfli algorithm and isn't multi-threaded anymore.
KrzyMOD's extensions to Zopfli offer the highest level of configuration and is therefore used for my brute-force search.
Ken Silverman wrote the closed-source KZIP compression program and Jonathon Fowler ported it to Linux.
Defluff was created by Joachim Henke; DeflOpt is a tool by Ben Jos Walbeehm.

website made by Stephan Brumme in 2015 and still improving in 2018.
all timestamps are displayed in central european time. see my changelog.
no flash, not even images or external css files - and everything squeezed into a single html file.
which was handsomely compressed before releasing it into the wild internet - obviously.

please visit my homepage and my blog, too.
email: minime (at) stephan-brumme.com