Choose a version:
48% The original file has 515704 bytes (503.6k) and is available from the project website.
There you can find the official minified version, too, which brings down the size to 248314 bytes (242.5k, 48%).

After GZIP compression these minified files vary in size:
unpkg
  93738 bytes (91.5k)
CDN
Boot
  82047 bytes (80.1k)
CDN
cdnjs
  82047 bytes (80.1k)
CDN
gzip -6 (default)
  81411 bytes (79.5k)
local copy
gzip -9
  81106 bytes (79.2k)
local copy
libdeflate -12
  77913 bytes (76.1k)
local copy
7zip -mx=9 -tgzip
  77427 bytes (75.6k)
local copy
zultra
  77110 bytes (75.3k)
local copy
kzip -s0 -rn -b8
  77074 bytes (75.3k)
local copy
pigz -11 -n
  76960 bytes (75.2k)
local copy
Zopfli
  76899 bytes (75.1k)
local copy

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

You will automatically get the smallest D3 5.16.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 5148 bytes by using my D3 5.16.0 Zopfli version instead of the best available CDN (6.69% smaller than cdnjs, 76899 vs. 82047 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 --mls16384 --bsr18 --lazy --ohh

(found April 28, 2020)
Description Value Parameter
iterations 1000000  --i1000000
maximum blocks 8  --mb8
maximum length score 16384  --mls16384
block splitting recursion 18  --bsr18
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

Verify file integrity

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

MD5:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v5.16.0/d3.zip --location | md5sum
f0b2ec5afc87eb622d86f587dad23e02  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-5.16.0.min.zopfli.js.gz | md5sum
f0b2ec5afc87eb622d86f587dad23e02  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v5.16.0/d3.zip --location | sha1sum
b08505510b7196e07a641962dda9c0b104ebca58  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-5.16.0.min.zopfli.js.gz | sha1sum
b08505510b7196e07a641962dda9c0b104ebca58  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
unpkg 93738 bytes f0b2ec5afc87eb622d86f587dad23e02 (invalid)
Boot 82047 bytes f0b2ec5afc87eb622d86f587dad23e02 April 20, 2020 @ 20:16
cdnjs 82047 bytes f0b2ec5afc87eb622d86f587dad23e02 April 20, 2020 @ 20:16

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

Other Versions

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

6.7.0, 6.6.2, 6.6.1, 6.6.0, 6.5.0, 6.4.0, 6.3.1, 6.2.0, 6.1.1, 6.1.0, 6.0.0,
5.16.0, 5.15.1, 5.15.0, 5.14.2, 5.14.1, 5.14.0, 5.13.1, 5.13.0, 5.12.0, 5.11.0, 5.10.1, 5.10.0,
5.9.7, 5.9.6, 5.9.5, 5.9.4, 5.9.3, 5.9.2, 5.9.1, 5.9.0, 5.8.2, 5.8.1, 5.8.0, 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
76899 bytes -5 bytes zopfli --i1000000 --mls16384 --bsr18 --lazy --ohh April 28, 2020 @ 05:00
76904 bytes -8 bytes zopfli --i100000 --mls16384 --bsr18 --lazy --ohh April 27, 2020 @ 13:17
76912 bytes -9 bytes zopfli --i10000 --mls16384 --bsr18 --lazy --ohh April 27, 2020 @ 11:49
76921 bytes -8 bytes zopfli --i1000 --mls16384 --bsr18 --lazy --ohh April 27, 2020 @ 11:31
76929 bytes -21 bytes zopfli --i1000 --mls8192 --bsr7 --lazy --ohh April 27, 2020 @ 11:31
76950 bytes -3 bytes zopfli --i1000 --mls2048 --bsr10 --lazy --ohh April 27, 2020 @ 11:30
76953 bytes zopfli --i100 --mls16384 --bsr18 --lazy --ohh April 27, 2020 @ 11:07

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

Most recent activity on July 20, 2020 @ 12:55.

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
77306 77299 77369 77364 77354 77357 77372 77357 77480 77506 77523 77515 77332 77337 77331
77166 77167 77195 77012 77030 77019 77033 77209 77426 77134 77137 77308 77125 77288 77088
77131 77372 77165 77156 76956 76966 76962 77148 77141 76971 76946 76961 77118 77103 77104
77285 77365 77262 77257 76968 76973 77149 77156 77166 77205 76945 76958 76919 77021 77081
77146 77260 77246 77245 77018 77241 77235 77229 77249 77280 77058 76959 77134 77101 77045
77138 77145 77155 77158 77151 76960 76951 77142 77147 77173 76936 76960 77176 77154 77239
77121 77123 77128 77151 77164 76961 77149 77149 77156 76948 76940 76964 77108 77037 77207
77280 77274 77338 77164 76957 76953 77144 77210 77146 77128 77149 76938 76938 77014 77192
76944 77133 77154 77148 76947 76963 77147 77147 77149 77164 77240 76962 77112 77040 77186
77138 77252 77260 77141 76965 76969 77146 77147 77142 77178 76943 76961 77110 77100 77240
77267 77143 77257 76956 76960 76958 77147 77146 77153 77131 76966 76948 77108 77138 77133
77266 77237 77234 77173 76958 76958 77144 76954 77254 77171 76944 76956 77110 77125 77084
77130 77274 77147 77159 76954 76956 77146 77128 77146 77191 77077 76957 77099 77002 77192
77140 77265 77278 77367 76943 77074 77144 77147 77152 77125 76943 76960 77098 76908 77185
77162 77163 77162 77163 76952 76959 77144 77131 77149 77127 76950 76943 77134 76899 77087
77237 77140 77144 77160 76951 76959 76955 77148 77150 77126 76941 76960 77108 77106 77076
77145 77134 77149 77140 76951 76963 77148 77143 77151 77127 76946 76938 77108 77100 77080
77134 77265 77156 77157 76949 76962 77151 77150 77149 77135 76948 76959 77111 77099 77079
77278 77262 77247 77267 76959 76960 77152 77151 77152 77127 76946 76959 77110 77099 77076
77286 77143 77157 77282 76949 76957 76956 77147 77150 77149 76947 76937 77106 76987 77112
77133 77158 77140 77155 76953 76960 77146 77148 77151 77143 76937 76960 77098 76977 77199
77263 77151 77146 77163 76953 76963 77153 77146 77151 77140 76948 77131 77106 77106 77192
77139 77257 77266 77170 77156 76955 77150 77149 77151 77130 76935 76956 77120 77121 77128

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 76953 bytes 100%
1,000 76921 bytes -32 bytes 100%
10,000 76912 bytes -9 bytes 100%
100,000 76904 bytes -8 bytes 0.58%
1,000,000 76899 bytes -5 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
77357 bytes +458 bytes (+0.60%) +283 bytes
78738 bytes +1839 bytes (+2.39%) +1664 bytes
78607 bytes +1708 bytes (+2.22%) +1533 bytes
77354 bytes +455 bytes (+0.59%) +280 bytes
77356 bytes +457 bytes (+0.59%) +282 bytes
77339 bytes +440 bytes (+0.57%) +265 bytes
77311 bytes +412 bytes (+0.54%) +237 bytes
77127 bytes +228 bytes (+0.30%) +53 bytes
77074 bytes +175 bytes (+0.23%)

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 60464 bytes -16435 bytes (-21.37%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 67329 bytes -9570 bytes (-12.44%)
LZMA2 (Wikipedia) xz xz -9 68184 bytes -8715 bytes (-11.33%)
Brotli (Wikipedia) brotli brotli -q 11 68459 bytes -8440 bytes (-10.98%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 70379 bytes -6520 bytes (-8.48%)
Zstandard (Wikipedia) zstd zstd -19 73662 bytes -3237 bytes (-4.21%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 76358 bytes -541 bytes (-0.70%)

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

All trademarks are property of their respective owners. You know, the boring legal stuff.