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

After GZIP compression these minified files vary in size:
Boot
  60612 bytes (59.2k)
CDN
jsdelivr
  60612 bytes (59.2k)
CDN
cdnjs
  53540 bytes (52.3k)
CDN
unpkg
  53249 bytes (52.0k)
CDN
gzip -6 (default)
  53133 bytes (51.9k)
local copy
gzip -9
  52980 bytes (51.7k)
local copy
zultra
  51272 bytes (50.1k)
local copy
7zip -mx=9 -tgzip
  51270 bytes (50.1k)
local copy
libdeflate -12
  51270 bytes (50.1k)
local copy
pigz -11 -n
  50980 bytes (49.8k)
local copy
kzip -s0 -rn -b7
  50960 bytes (49.8k)
local copy
Zopfli
  50898 bytes (49.7k)
local copy
Zopfli (defluff)
  50895 bytes (49.7k)
local copy

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

You will automatically get the smallest D3 3.5.1 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 2351 bytes by using my D3 3.5.1 Zopfli version instead of the best available CDN (4.62% smaller than unpkg, 50898 vs. 53249 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 --i100000 --mb8 --mls2048 --bsr9 --lazy --ohh

(found October 21, 2015)
Description Value Parameter
iterations 100000  --i100000
maximum blocks 8  --mb8
maximum length score 2048  --mls2048
block splitting recursion 9  --bsr9
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 (50895 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/v3.5.1/d3.min.js --location | md5sum
29ca65b725eef6ae6281c5b3028672c2  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-3.5.1.min.zopfli.js.gz | md5sum
29ca65b725eef6ae6281c5b3028672c2  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v3.5.1/d3.min.js --location | sha1sum
25adb9afbeb36ff33f7151f07764e0807d954481  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-3.5.1.min.zopfli.js.gz | sha1sum
25adb9afbeb36ff33f7151f07764e0807d954481  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
Boot 60612 bytes 29ca65b725eef6ae6281c5b3028672c2 (invalid)
jsdelivr 60612 bytes 29ca65b725eef6ae6281c5b3028672c2 (invalid)
cdnjs 53540 bytes 29ca65b725eef6ae6281c5b3028672c2 (invalid)
unpkg 53249 bytes 29ca65b725eef6ae6281c5b3028672c2 July 11, 2016 @ 16:30

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
50898 bytes -5 bytes zopfli --i100000 --mls2048 --bsr9 --lazy --ohh October 21, 2015 @ 14:27
50903 bytes -1 byte zopfli --i10000 --mls2048 --bsr9 --lazy --ohh October 13, 2015 @ 19:02
50904 bytes -3 bytes zopfli --i100000 --mls1024 --bsr13 --lazy --ohh September 28, 2015 @ 10:53
50907 bytes -7 bytes zopfli --i10000 --mls1024 --bsr13 --lazy --ohh September 28, 2015 @ 09:18
50914 bytes -1 byte zopfli --i1000 --mls1024 --bsr13 --lazy --ohh September 19, 2015 @ 03:24
50915 bytes -3 bytes zopfli --i1000 --mls2048 --bsr11 --lazy --ohh September 19, 2015 @ 03:16
50918 bytes -12 bytes zopfli --i1000 --mls1024 --bsr9 --lazy --ohh September 19, 2015 @ 03:14
50930 bytes -4 bytes zopfli --i1000 --mls1024 --bsr4 --lazy --ohh September 19, 2015 @ 03:12
50934 bytes -1 byte zopfli --i1000 --mls16 --bsr14 --lazy --ohh September 19, 2015 @ 02:52
50935 bytes zopfli --i100 --mls1024 --bsr9 --lazy --ohh September 18, 2015 @ 21:49

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:53.

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 or 100,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
51084 51100 51102 51086 51092 51089 51093 51092 51055 51166 51179 51164 51174 51168 51176
51004 51183 50949 50957 51004 50972 51024 51010 50947 50922 51175 51048 51176 50945 50948
50986 51019 50950 50989 50983 50960 50967 50966 50932 50956 51172 51025 51174 51174 51172
51012 51013 50964 51004 51083 51015 51029 51025 50928 50926 50998 51031 51169 50936 50955
51031 51009 50969 50994 51006 51037 50996 51031 50929 50993 50906 51039 51173 51061 51171
51005 51016 50980 51002 50982 50985 50994 50988 50941 50909 50898 51014 51168 50928 50945
50992 51095 50962 50962 50998 50971 51034 51007 50931 50924 51173 51016 51169 50937 51171
50980 51010 50966 50966 50970 50965 50994 50985 50932 50916 50901 51018 51171 50922 50951
50987 50958 50937 51075 50981 50969 51060 50935 50932 50910 51174 51027 51165 50939 50945
50981 50976 50961 50942 50949 51003 50994 50992 50922 50904 50921 51026 51172 50929 50948
51004 50994 50963 50928 50999 50960 51026 50977 50920 50928 50920 51015 51170 50930 50957
51011 51012 50950 50973 51101 51007 51010 50984 50936 50911 50916 51017 51170 50934 50954
50983 50960 50964 51000 51102 51006 51100 51007 50929 50943 50988 51038 51171 50939 50956
50988 50956 50943 50974 50968 51004 51102 51004 50915 50945 50906 51043 51169 50920 50945
50985 51056 50962 50975 50935 51008 51043 51008 50923 50930 50933 51017 51173 50933 50953
50986 50953 50966 50980 50987 51008 51001 50993 50921 50937 51012 51013 51171 50935 50948
51002 51003 50937 50935 50966 50960 51062 51034 50923 50929 50976 51014 51169 50933 50993
51005 51002 50937 50984 50968 50972 50998 51000 50916 50914 50987 51027 51169 50934 50952
51007 51011 50962 50926 50979 51007 51062 51034 50934 50920 50909 51015 51170 50934 50974
50974 50958 50965 50976 50970 50961 51004 51002 50938 50934 50906 51013 51170 50947 50945
51005 50974 50954 50991 50969 51006 50996 50984 50921 50927 50982 51014 51169 50953 50948
51009 51094 50935 50972 50970 50957 50993 50995 50924 50927 50917 51025 51171 50936 50948
51006 51005 50974 50997 50959 51002 51000 51034 50921 50928 50907 51018 51173 50927 50994

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 50935 bytes 100%
1,000 50914 bytes -21 bytes 100%
10,000 50903 bytes -11 bytes 100%
100,000 50898 bytes -5 bytes 0.87%
1,000,000
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
51211 bytes +313 bytes (+0.61%) +251 bytes
51211 bytes +313 bytes (+0.61%) +251 bytes
51219 bytes +321 bytes (+0.63%) +259 bytes
51157 bytes +259 bytes (+0.51%) +197 bytes
51099 bytes +201 bytes (+0.39%) +139 bytes
51101 bytes +203 bytes (+0.40%) +141 bytes
51009 bytes +111 bytes (+0.22%) +49 bytes
50960 bytes +62 bytes (+0.12%)
50977 bytes +79 bytes (+0.16%) +17 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 40630 bytes -10268 bytes (-20.17%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 43229 bytes -7669 bytes (-15.07%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 44260 bytes -6638 bytes (-13.04%)
Brotli (Wikipedia) brotli brotli -q 11 45986 bytes -4912 bytes (-9.65%)
LZMA2 (Wikipedia) xz xz -9 46728 bytes -4170 bytes (-8.19%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 48609 bytes -2289 bytes (-4.50%)
Zstandard (Wikipedia) zstd zstd -19 49210 bytes -1688 bytes (-3.32%)

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.