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

After GZIP compression these minified files vary in size:
Boot
  84062 bytes (82.1k)
CDN, direct link
cdnjs
  74260 bytes (72.5k)
CDN, direct link
gzip -6 (default)
  73790 bytes (72.1k)
local copy
gzip -9
  73516 bytes (71.8k)
local copy
libdeflate -12
  70663 bytes (69.0k)
local copy
7zip -mx=9 -tgzip
  70314 bytes (68.7k)
local copy
kzip -s0 -rn -b8
  70090 bytes (68.4k)
local copy
pigz -11 -n
  69937 bytes (68.3k)
local copy
Zopfli
  69843 bytes (68.2k)
local copy
Zopfli (defluff)
  69841 bytes (68.2k)
local copy

perma-link to the smallest file on my server:
http://minime.stephan-brumme.com/files/d3/d3-4.9.0.min.js

You will automatically get the smallest D3 4.9.0 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 4417 bytes by using my D3 4.9.0 Zopfli version instead of the best available CDN (6.32% smaller than cdnjs, 69843 vs. 74260 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 --mls2 --bsr23 --lazy --ohh

(found May 17, 2017)
Description Value Parameter
iterations 1000000  --i1000000
maximum blocks 8  --mb8
maximum length score 2  --mls2
block splitting recursion 23  --bsr23
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 2 more bytes (69841 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.9.0/d3.zip --location | md5sum
189b66ca055cf468473b8b366fd3d70b  -
curl --silent --compressed http://minime.stephan-brumme.com/files/d3/d3-4.9.0.min.zopfli.js.gz | md5sum
189b66ca055cf468473b8b366fd3d70b  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v4.9.0/d3.zip --location | sha1sum
0d8b7da4bd0b51a9936eb5c4bd13741695ad60c6  -
curl --silent --compressed http://minime.stephan-brumme.com/files/d3/d3-4.9.0.min.zopfli.js.gz | sha1sum
0d8b7da4bd0b51a9936eb5c4bd13741695ad60c6  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
Boot 84062 bytes 189b66ca055cf468473b8b366fd3d70b May 19, 2017 @ 02:06
cdnjs 74260 bytes 189b66ca055cf468473b8b366fd3d70b May 15, 2017 @ 21:34

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

Other Versions

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

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
69843 bytes -4 bytes zopfli --i1000000 --mls2 --bsr23 --lazy --ohh May 17, 2017 @ 21:58
69847 bytes -2 bytes zopfli --i100000 --mls2 --bsr23 --lazy --ohh May 17, 2017 @ 11:11
69849 bytes -5 bytes zopfli --i100000 --mls4 --bsr10 --lazy --ohh May 17, 2017 @ 11:11
69854 bytes -5 bytes zopfli --i10000 --mls2 --bsr23 --lazy --ohh May 16, 2017 @ 19:46
69859 bytes -1 byte zopfli --i1000 --mls4 --bsr15 --lazy --ohh May 16, 2017 @ 18:58
69860 bytes -25 bytes zopfli --i1000 --mls4 --bsr10 --lazy --ohh May 16, 2017 @ 18:57
69885 bytes zopfli --i100 --mls4 --bsr10 --lazy --ohh May 16, 2017 @ 18:55

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

Most recent activity on May 19, 2017 @ 02:06.

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
70139 70141 70200 70158 70250 70263 70227 70106 70068 70115 70091 70074 70059 70107 70110
69916 70041 70092 69936 70031 69920 70003 69937 70046 70017 70009 70014 70024 70014 70030
69980 69980 69915 69958 69945 69977 69999 69873 70002 70019 70009 70019 70019 70017 70031
69944 69947 69871 69923 69958 70118 70285 70261 70005 69995 70008 69997 70045 70009 70026
70007 69893 69904 69959 69981 70112 70006 70080 70010 70006 70028 70075 70021 70063 70029
69941 69876 69891 69952 69914 70125 69998 69998 70023 70001 69985 69902 70004 70012 70045
69938 69849 70029 69946 70127 70127 70024 70019 69982 69994 69998 70038 70027 70004 69996
69982 69866 69948 69951 70107 70121 69996 70048 70004 70000 69999 69929 69996 70052 69995
69979 69897 69893 69891 70107 70106 70023 70000 70037 69997 70003 70033 69994 70033 70049
69980 69892 69916 69890 70087 70024 70025 70039 69997 69997 69991 69918 70041 70033 70022
69986 69992 69898 69917 70101 70108 70001 70033 70000 70001 70001 70047 70037 70032 70038
69940 69848 69946 69946 70106 70116 70038 70069 70047 70002 70012 70007 70037 70031 70027
69970 69889 69894 69978 71004 70099 70076 70004 70051 70000 70025 70019 70039 70004 69994
69979 69870 69895 71010 70998 70109 70002 70003 70002 69972 69989 69915 70007 70031 69999
69989 69948 70918 70085 70074 70114 70089 70053 70006 70000 69989 70042 70029 70035 70023
69979 69858 69899 69948 70095 70124 70026 70005 70000 69979 69989 69988 70017 70034 70047
69943 69987 69895 70966 70109 70090 70072 70007 70000 69982 69993 70009 70026 70035 70028
69912 69857 70029 69890 70109 70125 70001 70032 69983 70001 70006 70039 70014 70003 70002
69976 69857 69896 69948 70112 70108 70002 70013 70001 70000 69999 70030 70017 70025 69996
69843 69849 69893 69950 69924 70109 70018 70004 69868 69922 69997 70030 69988 70026 69997
69946 69873 69896 69952 69920 70116 70000 70041 69870 69928 69971 69892 70018 70033 70025
69949 69897 69895 69954 70084 70120 69975 70041 69994 69971 70001 70031 70018 70021 70008
69979 69980 69891 69948 70103 70127 70013 70008 70005 69980 69976 70024 70016 70026 70018

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 69885 bytes 100%
1,000 69859 bytes -26 bytes 100%
10,000 69854 bytes -5 bytes 100%
100,000 69847 bytes -7 bytes 1.16%
1,000,000 69843 bytes -4 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
70090 bytes +247 bytes (+0.35%)
71429 bytes +1586 bytes (+2.27%) +1339 bytes
71099 bytes +1256 bytes (+1.80%) +1009 bytes
70216 bytes +373 bytes (+0.53%) +126 bytes
70099 bytes +256 bytes (+0.37%) +9 bytes
70109 bytes +266 bytes (+0.38%) +19 bytes
70130 bytes +287 bytes (+0.41%) +40 bytes
70098 bytes +255 bytes (+0.37%) +8 bytes
70090 bytes +247 bytes (+0.35%)

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
ZPAQ (Wikipedia) zpaq zpaq -method 69 54874 bytes -14969 bytes (-21.43%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 60937 bytes -8906 bytes (-12.75%)
LZMA2 (Wikipedia) xz xz -9 61912 bytes -7931 bytes (-11.36%)
Brotli (Wikipedia) brotli brotli -q 11 62012 bytes -7831 bytes (-11.21%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 63020 bytes -6823 bytes (-9.77%)
ZSTD (Wikipedia) zstd zstd -19 67383 bytes -2460 bytes (-3.52%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 68566 bytes -1277 bytes (-1.83%)

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 2017.
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