Choose a version:
45% The original file has 471129 bytes (460.1k) and is available from the project website.
There you can find the official minified version, too, which brings down the size to 211605 bytes (206.6k, 45%).

After GZIP compression these minified files vary in size:
Boot
  80515 bytes (78.6k)
CDN, direct link
cdnjs
  70790 bytes (69.1k)
CDN, direct link
cdnhttps
  70567 bytes (68.9k)
CDN, direct link
gzip -6 (default)
  70225 bytes (68.6k)
local copy
gzip -9
  70005 bytes (68.4k)
local copy
libdeflate -12
  67388 bytes (65.8k)
local copy
7zip -mx=9 -tgzip
  66979 bytes (65.4k)
local copy
kzip -s0 -rn -b8
  66570 bytes (65.0k)
local copy
pigz -11 -n
  66532 bytes (65.0k)
local copy
Zopfli
  66441 bytes (64.9k)
local copy
Zopfli (defluff)
  66439 bytes (64.9k)
local copy

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

You will automatically get the smallest D3 4.2.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 4126 bytes by using my D3 4.2.0 Zopfli version instead of the best available CDN (6.21% smaller than cdnhttps, 66441 vs. 70567 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 --mls2048 --bsr8 --lazy --ohh

(found August 2, 2016)
Description Value Parameter
iterations 1000000  --i1000000
maximum blocks 8  --mb8
maximum length score 2048  --mls2048
block splitting recursion 8  --bsr8
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 (66439 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.2.0/d3.zip --location | md5sum
66fa27347c662ca06f5d0d49dc29a4b0  -
curl --silent --compressed http://minime.stephan-brumme.com/files/d3/d3-4.2.0.min.zopfli.js.gz | md5sum
66fa27347c662ca06f5d0d49dc29a4b0  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v4.2.0/d3.zip --location | sha1sum
0232aa169ded856fb96491c7602cbe41b597280a  -
curl --silent --compressed http://minime.stephan-brumme.com/files/d3/d3-4.2.0.min.zopfli.js.gz | sha1sum
0232aa169ded856fb96491c7602cbe41b597280a  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
Boot 80515 bytes 66fa27347c662ca06f5d0d49dc29a4b0 August 2, 2016 @ 07:46
cdnjs 70790 bytes 66fa27347c662ca06f5d0d49dc29a4b0 July 30, 2016 @ 08:01
cdnhttps 70567 bytes 66fa27347c662ca06f5d0d49dc29a4b0 November 22, 2016 @ 16:32

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

Other Versions

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

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
66441 bytes -2 bytes zopfli --i1000000 --mls2048 --bsr8 --lazy --ohh August 2, 2016 @ 18:31
66443 bytes -6 bytes zopfli --i100000 --mls2048 --bsr8 --lazy --ohh August 1, 2016 @ 13:11
66449 bytes -2 bytes zopfli --i10000 --mls2048 --bsr8 --lazy --ohh August 1, 2016 @ 12:00
66451 bytes -5 bytes zopfli --i10000 --mls2048 --bsr23 --lazy --ohh August 1, 2016 @ 11:53
66456 bytes -2 bytes zopfli --i1000 --mls2048 --bsr8 --lazy --ohh August 1, 2016 @ 11:45
66458 bytes -24 bytes zopfli --i1000 --mls2048 --bsr23 --lazy --ohh August 1, 2016 @ 11:44
66482 bytes zopfli --i100 --mls2048 --bsr23 --lazy --ohh August 1, 2016 @ 11:40

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

Most recent activity on November 22, 2016 @ 16:32.

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
66836 66797 66669 66625 66681 66676 66619 66672 66667 66599 66688 66682 66808 66747 66781
66592 66581 66640 66703 66590 66583 66586 66462 66502 66492 66477 66553 66656 66555 66632
66688 66674 66492 66652 66655 66559 66573 66581 66531 66479 66459 66466 66478 66595 66619
66664 66579 66655 66561 66565 66565 66572 66554 66576 66519 66465 66479 66611 66462 66701
67170 66643 67166 67168 67165 66643 66568 66572 66457 66459 66441 66467 66462 66575 66533
66653 66640 66655 66657 66562 66560 66560 66555 66579 66515 66471 66467 66633 66511 66613
67176 67155 66567 67141 66583 66555 66560 66584 66575 66451 66463 66468 66612 66581 66577
66649 66642 66661 66651 66572 66559 67143 66558 66575 66468 66452 66464 66608 66526 66625
66657 66577 66652 66651 66657 66652 66561 66560 66574 66469 66460 66468 66605 66602 66609
67177 67180 66644 67157 66571 66557 66640 66562 66447 66462 66456 66465 66608 66594 66616
66669 66653 67170 66671 66657 66650 66508 66559 66494 66457 66474 66488 66608 66505 66637
66667 66653 66575 66578 66538 66562 66545 66547 66499 66461 66459 66479 66611 66606 66630
66657 66662 66657 67155 66656 66651 66559 66565 66500 66537 66549 66473 66464 66578 66576
66653 67152 67159 66646 66573 66565 66660 66553 66571 66462 66445 66464 66600 66514 66570
67170 66653 67155 66650 66644 66641 66564 66560 66507 66458 66450 66460 66605 66533 66606
66659 66644 67159 66650 66574 66572 66638 66557 66573 66460 66448 66480 66624 66457 66640
66658 66640 66659 66651 66660 66566 66560 66555 66574 66462 66457 66471 66603 66580 66632
66659 66642 66656 66642 66577 66557 66638 66552 66577 66461 66457 66456 66588 66489 66581
67152 66650 66657 66645 66574 66574 66635 66556 66572 66451 66462 66515 66611 66498 66582
66665 66641 67161 66654 66573 66556 66639 66563 66574 66463 66446 66509 66602 66506 66585
66655 66643 66654 66654 66657 66640 66636 66556 66575 66467 66458 66468 66610 66609 66606
66678 66660 66677 66670 66515 66510 66662 66565 66502 66464 66457 66473 66593 66615 66591
66658 66653 66657 66658 67148 66644 66573 66557 66505 66463 66462 66467 66608 66516 66637

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 66482 bytes 100%
1,000 66456 bytes -26 bytes 100%
10,000 66449 bytes -7 bytes 100%
100,000 66443 bytes -6 bytes 2.61%
1,000,000 66441 bytes -2 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
66630 bytes +189 bytes (+0.28%) +60 bytes
68125 bytes +1684 bytes (+2.53%) +1555 bytes
67621 bytes +1180 bytes (+1.78%) +1051 bytes
67235 bytes +794 bytes (+1.20%) +665 bytes
66740 bytes +299 bytes (+0.45%) +170 bytes
66736 bytes +295 bytes (+0.44%) +166 bytes
66617 bytes +176 bytes (+0.26%) +47 bytes
66632 bytes +191 bytes (+0.29%) +62 bytes
66570 bytes +129 bytes (+0.19%)

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 52793 bytes -13648 bytes (-20.54%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 59117 bytes -7324 bytes (-11.02%)
LZMA2 (Wikipedia) xz xz -9 59636 bytes -6805 bytes (-10.24%)
Brotli (Wikipedia) brotli brotli -q 11 59995 bytes -6446 bytes (-9.70%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 60611 bytes -5830 bytes (-8.77%)
ZSTD (Wikipedia) zstd zstd -19 64912 bytes -1529 bytes (-2.30%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 66461 bytes +20 bytes (+0.03%)

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