Choose a version:
47% The original file has 471591 bytes (460.5k) and is available from the project website.
There you can find the official minified version, too, which brings down the size to 221645 bytes (216.5k, 47%).

After GZIP compression these minified files vary in size:
Boot
  84737 bytes (82.8k)
CDN
cdnjs
  74655 bytes (72.9k)
CDN
gzip -6 (default)
  74090 bytes (72.4k)
local copy
gzip -9
  73838 bytes (72.1k)
local copy
libdeflate -12
  70801 bytes (69.1k)
local copy
7zip -mx=9 -tgzip
  70605 bytes (69.0k)
local copy
pigz -11 -n
  70193 bytes (68.5k)
local copy
kzip -s0 -rn -b0
  70103 bytes (68.5k)
local copy
Zopfli
  70060 bytes (68.4k)
local copy
Zopfli (defluff)
  70057 bytes (68.4k)
local copy

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

You will automatically get the smallest D3 4.12.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 4595 bytes by using my D3 4.12.2 Zopfli version instead of the best available CDN (6.56% smaller than cdnjs, 70060 vs. 74655 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 --i1000000 --mb8 --mls8192 --bsr10 --lazy --ohh

(found December 30, 2017)
Description Value Parameter
iterations 1000000  --i1000000
maximum blocks 8  --mb8
maximum length score 8192  --mls8192
block splitting recursion 10  --bsr10
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 3 more bytes (70057 bytes).

Verify file integrity

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

MD5:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v4.12.2/d3.zip --location | md5sum
00ac35990f33fad3241b98d0914f8fd2  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-4.12.2.min.zopfli.js.gz | md5sum
00ac35990f33fad3241b98d0914f8fd2  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v4.12.2/d3.zip --location | sha1sum
6220c3a2874fb95bd68a8fcfdf65b2236784bd86  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-4.12.2.min.zopfli.js.gz | sha1sum
6220c3a2874fb95bd68a8fcfdf65b2236784bd86  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
Boot 84737 bytes 00ac35990f33fad3241b98d0914f8fd2 January 1, 2018 @ 13:46
cdnjs 74655 bytes 00ac35990f33fad3241b98d0914f8fd2 December 26, 2017 @ 23:17

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

Other Versions

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

5.7.0, 5.6.0, 5.5.0, 5.4.0, 5.3.0, 5.2.0, 5.1.0, 5.0.1, 5.0.0,
4.13.0, 4.12.2, 4.12.1, 4.12.0, 4.11.0, 4.10.2, 4.10.1, 4.10.0,
4.9.1, 4.9.0, 4.8.0, 4.7.4, 4.7.3, 4.7.2, 4.7.1, 4.7.0, 4.6.0, 4.5.0, 4.4.4, 4.4.3, 4.4.2, 4.4.1, 4.4.0, 4.3.0, 4.2.8, 4.2.7, 4.2.6, 4.2.5, 4.2.4, 4.2.3, 4.2.2, 4.2.1, 4.2.0, 4.1.1, 4.1.0, 4.0.0,
3.5.17, 3.5.16, 3.5.15, 3.5.14, 3.5.13, 3.5.12, 3.5.11, 3.5.10, 3.5.9, 3.5.8, 3.5.7, 3.5.6, 3.5.5, 3.5.4, 3.5.3, 3.5.2, 3.5.1, 3.5.0, 3.4.13, 3.4.12, 3.4.11, 3.4.10, 3.4.9, 3.4.8, 3.4.6, 3.4.5, 3.4.4, 3.4.3, 3.4.2, 3.4.1, 3.4.0, 3.3.13, 3.3.12, 3.3.11, 3.3.10, 3.3.9, 3.3.8, 3.3.7, 3.3.6, 3.3.5, 3.3.4, 3.3.3, 3.3.2, 3.3.1, 3.3.0, 3.2.8, 3.2.7, 3.2.6, 3.2.5, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0, 3.1.10, 3.1.9, 3.1.8, 3.1.7, 3.1.6, 3.1.5, 3.1.4, 3.1.3, 3.1.2, 3.1.1, 3.1.0, 3.0.8, 3.0.7, 3.0.6, 3.0.5, 3.0.4, 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, Bootstrap, Dojo, Ember, jQuery, Knockout, lodash, React, Socket.IO, ThreeJS, UnderscoreJS and Vue.

Changelog

Best Zopfli parameters so far:
Size Improvement Parameters Found
70060 bytes -6 bytes zopfli --i1000000 --mls8192 --bsr10 --lazy --ohh December 30, 2017 @ 01:52
70066 bytes -4 bytes zopfli --i100000 --mls8192 --bsr9 --lazy --ohh December 29, 2017 @ 16:14
70070 bytes -1 byte zopfli --i10000 --mls16384 --bsr21 --lazy --ohh December 29, 2017 @ 01:07
70071 bytes -5 bytes zopfli --i10000 --mls8192 --bsr9 --lazy --ohh December 28, 2017 @ 21:30
70076 bytes -4 bytes zopfli --i10000 --mls8192 --bsr6 --lazy --ohh December 28, 2017 @ 21:16
70080 bytes -2 bytes zopfli --i10000 --mls4 --bsr16 --lazy --ohh December 28, 2017 @ 21:10
70082 bytes -11 bytes zopfli --i1000 --mls8192 --bsr9 --lazy --ohh December 28, 2017 @ 15:51
70093 bytes zopfli --i100 --mls16384 --bsr21 --lazy --ohh December 28, 2017 @ 15:08

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

Most recent activity on January 1, 2018 @ 13:46.

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
70428 70421 70350 70333 70346 70341 70348 70340 70320 70235 70196 70208 70222 70213 70332
70118 70124 70215 70201 70217 70193 70215 70209 70194 70154 70153 70101 70099 70136 70122
70099 70106 70137 70120 70128 70143 70109 70111 70131 70166 70084 70110 70076 70091 70119
70183 70140 70118 70118 70116 70115 70098 70108 70103 70110 70212 70101 70129 70110 70147
70168 70171 70136 70139 70157 70102 70105 70256 70265 70322 70131 70141 70280 70148 70232
70079 70109 70116 70159 70094 70102 70117 70085 70131 70129 70098 70167 70062 70089 70247
70109 70085 70115 70125 70109 70103 70107 70085 70102 70100 70110 70100 70060 70083 70109
70097 70102 70151 70128 70146 70206 70114 70267 70124 70266 70112 70102 70125 70085 70138
70114 70106 70124 70101 70108 70110 70110 70109 70121 70090 70092 70135 70103 70083 70163
70135 70147 70125 70148 70148 70109 70139 70136 70118 70101 70099 70130 70129 70099 70093
70113 70103 70117 70096 70096 70099 70102 70115 70119 70134 70114 70128 70136 70085 70112
70103 70103 70121 70091 70091 70101 70088 70096 70097 70092 70099 70129 70112 70092 70103
70128 70080 70147 70091 70092 70091 70089 70086 70094 70098 70112 70133 70104 70104 70095
70124 70145 70170 70136 70165 70161 70168 70162 70115 70119 70132 70101 70125 70085 70106
70128 70120 70117 70119 70089 70102 70095 70134 70132 70104 70146 70127 70120 70094 70100
70098 70105 70115 70114 70088 70099 70095 70105 70121 70142 70100 70123 70120 70108 70116
70102 70112 70110 70092 70098 70091 70099 70123 70109 70098 70091 70101 70134 70101 70078
70107 70100 70112 70121 70100 70099 70093 70095 70103 70106 70108 70145 70113 70067 70110
70142 70095 70149 70097 70095 70092 70093 70090 70145 70100 70110 70124 70109 70090 70093
70080 70099 70156 70141 70178 70099 70088 70196 70113 70121 70108 70108 70131 70102 70092
70108 70102 70118 70117 70091 70092 70095 70098 70123 70134 70105 70102 70109 70084 70096
70080 70083 70125 70114 70094 70085 70092 70092 70121 70098 70117 70123 70121 70082 70091
70115 70109 70114 70114 70100 70094 70093 70109 70097 70101 70096 70131 70111 70081 70107

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 70093 bytes 100%
1,000 70082 bytes -11 bytes 100%
10,000 70070 bytes -12 bytes 100%
100,000 70066 bytes -4 bytes 0.87%
1,000,000 70060 bytes -6 bytes 0.58%
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
70103 bytes +43 bytes (+0.06%)
71516 bytes +1456 bytes (+2.08%) +1413 bytes
71369 bytes +1309 bytes (+1.87%) +1266 bytes
71095 bytes +1035 bytes (+1.48%) +992 bytes
70281 bytes +221 bytes (+0.32%) +178 bytes
70115 bytes +55 bytes (+0.08%) +12 bytes
70109 bytes +49 bytes (+0.07%) +6 bytes
70116 bytes +56 bytes (+0.08%) +13 bytes
70121 bytes +61 bytes (+0.09%) +18 bytes

Non-DEFLATE Algorithms

Archivers based on completely different compression algorithms often produce superior results.
Unfortunately, browsers only support gzip compression at the moment.
However, support for Brotli is constantly growing - but your browser doesn't support it.
Algorithm Program Parameters Size Compared To Best Zopfli
ZPAQ (Wikipedia) zpaq zpaq -method 69 54751 bytes -15309 bytes (-21.85%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 60556 bytes -9504 bytes (-13.57%)
LZMA2 (Wikipedia) xz xz -9 61912 bytes -8148 bytes (-11.63%)
Brotli (Wikipedia) brotli brotli -q 11 62089 bytes -7971 bytes (-11.38%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 62957 bytes -7103 bytes (-10.14%)
Zstandard (Wikipedia) zstd zstd -19 67303 bytes -2757 bytes (-3.94%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 68091 bytes -1969 bytes (-2.81%)

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