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

After GZIP compression these minified files vary in size:
cdnjs
  78160 bytes (76.3k)
CDN
gzip -6 (default)
  77952 bytes (76.1k)
local copy
gzip -9
  77692 bytes (75.9k)
local copy
libdeflate -12
  74390 bytes (72.6k)
local copy
7zip -mx=9 -tgzip
  74164 bytes (72.4k)
local copy
pigz -11 -n
  73686 bytes (72.0k)
local copy
kzip -s0 -rn -b8
  73660 bytes (71.9k)
local copy
Zopfli
  73615 bytes (71.9k)
local copy
Zopfli (defluff)
  73613 bytes (71.9k)
local copy

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

You will automatically get the smallest D3 5.0.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 4545 bytes by using my D3 5.0.0 Zopfli version instead of the best available CDN (6.17% smaller than cdnjs, 73615 vs. 78160 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 --bsr14 --lazy --ohh

(found January 31, 2018)
Description Value Parameter
iterations 1000000  --i1000000
maximum blocks 8  --mb8
maximum length score 2048  --mls2048
block splitting recursion 14  --bsr14
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 (73613 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/v5.0.0/d3.zip --location | md5sum
18eb59775c6705a3f12fa0d26afdb2f7  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-5.0.0.min.zopfli.js.gz | md5sum
18eb59775c6705a3f12fa0d26afdb2f7  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v5.0.0/d3.zip --location | sha1sum
161765c079bd360c4db83e4deb685b9ed4fac337  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-5.0.0.min.zopfli.js.gz | sha1sum
161765c079bd360c4db83e4deb685b9ed4fac337  -

original/d3/d3-5.0.0.min.js.gz not found
CDN Size (compressed) MD5 (uncompressed) Comment / Diff Timestamp

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
73615 bytes -2 bytes zopfli --i1000000 --mls2048 --bsr14 --lazy --ohh January 31, 2018 @ 09:03
73617 bytes -7 bytes zopfli --i100000 --mls2048 --bsr14 --lazy --ohh January 30, 2018 @ 17:43
73624 bytes -14 bytes zopfli --i10000 --mls2048 --bsr14 --lazy --ohh January 30, 2018 @ 16:25
73638 bytes -7 bytes zopfli --i1000 --mls2048 --bsr14 --lazy --ohh January 30, 2018 @ 16:04
73645 bytes -3 bytes zopfli --i1000 --mls2048 --bsr15 --lazy --ohh January 30, 2018 @ 15:56
73648 bytes zopfli --i100 --mls2048 --bsr14 --lazy --ohh January 30, 2018 @ 15:39

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

Most recent activity on July 2, 2018 @ 18:58.

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
73978 73974 74128 74130 74290 74284 74138 74117 74143 74170 74309 74256 74258 73996 73985
74340 74328 74392 74380 74387 74375 74017 74036 74364 73869 73886 73883 73999 73745 73704
73787 73807 73799 73816 73795 73795 73810 73812 73783 73817 73634 73816 73806 73752 73918
73892 73821 73923 73818 73819 73807 73948 73788 73961 73807 73782 74056 73959 73813 73963
73825 73779 73927 73774 73921 73849 73828 73817 73780 73801 74013 73799 73798 73804 73921
73842 73845 73832 73829 73840 73829 73872 73814 73938 73824 73845 73977 73942 73926 73924
73846 73845 73764 73773 73915 73778 73794 73919 73925 73940 73735 74031 74223 73757 73932
73777 73787 73744 73730 73833 73746 73875 73812 73923 73936 73844 73953 73800 73931 73971
73767 73759 73829 73835 73843 73861 73835 73849 73789 73802 73810 73802 73855 73751 73927
73802 73775 73763 73779 73764 73791 73921 73799 73794 73920 73635 73956 73825 73866 73924
73805 73770 73763 73793 73755 73790 73922 73799 73772 73924 73615 73792 73796 73860 73786
73837 73895 73766 73788 73845 73785 73872 73811 73926 73803 73625 73954 73944 73732 73919
73814 73838 73750 73736 74077 73738 74090 73740 73821 73782 73804 73816 73790 73806 73923
73830 73823 73771 73769 73756 73784 73923 73817 73815 73785 73825 73801 73796 73802 73920
73830 73823 73856 73844 73880 73840 73826 73819 73968 73862 73671 73774 73784 73862 73916
73794 73790 73763 73768 73757 73797 73796 73801 73788 73825 73822 73808 73788 73758 73924
73825 73939 73845 73776 73945 73832 73948 73809 73816 73800 73841 73785 73793 73791 73749
73774 73788 73761 73770 73747 73794 73798 73793 73924 73945 73704 73951 73795 73742 73929
73827 73816 73759 73766 73912 73778 73816 73818 73924 73929 73797 73801 73798 73754 73780
73822 73815 73766 73808 73911 73821 73821 73816 73777 73923 73843 73962 73790 73932 73920
73807 73773 73763 73771 73756 73795 73919 73920 73919 73928 73808 73798 73933 73759 73925
73806 73775 73765 73770 73912 73788 73796 73792 73777 73770 73802 73955 74089 73914 73919
73803 73774 73764 73787 73788 73795 73929 73798 73783 73781 73637 73959 74145 73800 73922

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 73648 bytes 100%
1,000 73638 bytes -10 bytes 100%
10,000 73624 bytes -14 bytes 100%
100,000 73617 bytes -7 bytes 1.16%
1,000,000 73615 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
73867 bytes +252 bytes (+0.34%) +207 bytes
75374 bytes +1759 bytes (+2.39%) +1714 bytes
75207 bytes +1592 bytes (+2.16%) +1547 bytes
74036 bytes +421 bytes (+0.57%) +376 bytes
74017 bytes +402 bytes (+0.55%) +357 bytes
73985 bytes +370 bytes (+0.50%) +325 bytes
73868 bytes +253 bytes (+0.34%) +208 bytes
73679 bytes +64 bytes (+0.09%) +19 bytes
73660 bytes +45 bytes (+0.06%)

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 57734 bytes -15881 bytes (-21.57%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 64102 bytes -9513 bytes (-12.92%)
LZMA2 (Wikipedia) xz xz -9 65092 bytes -8523 bytes (-11.58%)
Brotli (Wikipedia) brotli brotli -q 11 65277 bytes -8338 bytes (-11.33%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 67187 bytes -6428 bytes (-8.73%)
Zstandard (Wikipedia) zstd zstd -19 70872 bytes -2743 bytes (-3.73%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 72681 bytes -934 bytes (-1.27%)

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