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

After GZIP compression these minified files vary in size:
Boot
  84891 bytes (82.9k)
CDN
cdnjs
  74807 bytes (73.1k)
CDN
gzip -6 (default)
  74218 bytes (72.5k)
local copy
gzip -9
  73938 bytes (72.2k)
local copy
libdeflate -12
  70989 bytes (69.3k)
local copy
7zip -mx=9 -tgzip
  70678 bytes (69.0k)
local copy
zultra
  70563 bytes (68.9k)
local copy
kzip -s0 -rn -b8
  70312 bytes (68.7k)
local copy
pigz -11 -n
  70311 bytes (68.7k)
local copy
Zopfli
  70186 bytes (68.5k)
local copy
Zopfli (defluff)
  70183 bytes (68.5k)
local copy

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

You will automatically get the smallest D3 4.12.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 4621 bytes by using my D3 4.12.0 Zopfli version instead of the best available CDN (6.58% smaller than cdnjs, 70186 vs. 74807 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 --mls128 --bsr11 --lazy --ohh

(found November 23, 2017)
Description Value Parameter
iterations 1000000  --i1000000
maximum blocks 8  --mb8
maximum length score 128  --mls128
block splitting recursion 11  --bsr11
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 (70183 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.12.0/d3.zip --location | md5sum
68c8b9a35f7b7400ef73282246f8cbe7  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-4.12.0.min.zopfli.js.gz | md5sum
68c8b9a35f7b7400ef73282246f8cbe7  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v4.12.0/d3.zip --location | sha1sum
d76cc8330c68f5f6b5739d59969419dcd36f470f  -
curl --silent --compressed https://minime.stephan-brumme.com/files/d3/d3-4.12.0.min.zopfli.js.gz | sha1sum
d76cc8330c68f5f6b5739d59969419dcd36f470f  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
Boot 84891 bytes 68c8b9a35f7b7400ef73282246f8cbe7 November 22, 2017 @ 09:07
cdnjs 74807 bytes 68c8b9a35f7b7400ef73282246f8cbe7 November 21, 2017 @ 23:48

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
70186 bytes -5 bytes zopfli --i1000000 --mls128 --bsr11 --lazy --ohh November 23, 2017 @ 05:01
70191 bytes -4 bytes zopfli --i100000 --mls128 --bsr11 --lazy --ohh November 22, 2017 @ 17:46
70195 bytes -11 bytes zopfli --i10000 --mls128 --bsr11 --lazy --ohh November 22, 2017 @ 16:32
70206 bytes -5 bytes zopfli --i1000 --mls128 --bsr11 --lazy --ohh November 22, 2017 @ 16:22
70211 bytes -1 byte zopfli --i1000 --mls256 --bsr15 --lazy --ohh November 22, 2017 @ 16:22
70212 bytes -5 bytes zopfli --i1000 --mls256 --bsr23 --lazy --ohh November 22, 2017 @ 16:22
70217 bytes -6 bytes zopfli --i1000 --mls128 --bsr19 --lazy --ohh November 22, 2017 @ 16:22
70223 bytes zopfli --i100 --mls128 --bsr11 --lazy --ohh November 22, 2017 @ 16:17

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, 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
70532 70529 70502 70457 70448 70666 70462 70638 70443 70492 70342 70355 70436 70463 70478
70305 70452 70287 70391 70235 70274 70372 70369 70383 70387 70369 70432 70423 70392 70408
70336 70288 70278 70280 70266 70280 70227 70361 70383 70363 70379 70272 70294 70382 70396
70618 70344 70239 70222 70229 70234 70239 70224 70233 70292 70371 70384 70422 70373 70388
70295 70290 70235 70301 70273 70289 70227 70277 70295 70273 70244 70372 70413 70430 70281
70280 70295 70306 70264 70243 70297 70203 70228 70239 70244 70380 70372 70357 70373 70383
70293 70289 70305 70266 70247 70281 70229 70269 70239 70212 70372 70388 70375 70361 70385
70320 70306 70301 70270 70249 70282 70186 70238 70274 70369 70365 70380 70357 70365 70385
70269 70255 70214 70257 70243 70214 70221 70250 70249 70277 70368 70254 70360 70369 70383
70342 70281 70264 70272 70242 70263 70215 70261 70242 70378 70245 70390 70359 70367 70386
70298 70259 70219 70249 70223 70289 70215 70240 70270 70256 70378 70261 70347 70379 70414
70285 70295 70234 70268 70227 70256 70215 70205 70220 70275 70217 70393 70422 70379 70389
70300 70286 70219 70260 70215 70259 70224 70228 70222 70255 70216 70376 70354 70369 70383
70298 70297 70254 70248 70215 70280 70217 70238 70211 70222 70365 70378 70282 70365 70383
70256 70253 70270 70268 70271 70256 70219 70266 70272 70369 70366 70403 70377 70366 70388
70253 70373 70340 70259 70231 70294 70209 70237 70240 70224 70365 70387 70364 70368 70411
70294 70290 70195 70274 70234 70286 70219 70230 70248 70259 70214 70389 70362 70368 70384
70292 70292 70222 70275 70240 70282 70226 70239 70243 70242 70379 70375 70360 70369 70388
70252 70253 70252 70250 70229 70261 70215 70253 70250 70257 70211 70390 70362 70368 70390
70280 70284 70281 70282 70223 70257 70216 70204 70243 70287 70215 70221 70357 70368 70386
70283 70291 70289 70290 70295 70280 70284 70279 70261 70241 70241 70276 70357 70363 70375
70259 70294 70290 70302 70217 70261 70211 70221 70256 70275 70372 70383 70354 70370 70386
70295 70293 70256 70255 70212 70281 70215 70203 70219 70258 70223 70231 70402 70397 70376

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 70223 bytes 100%
1,000 70206 bytes -17 bytes 100%
10,000 70195 bytes -11 bytes 100%
100,000 70191 bytes -4 bytes 0.58%
1,000,000 70186 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
70395 bytes +209 bytes (+0.30%) +83 bytes
71624 bytes +1438 bytes (+2.05%) +1312 bytes
71493 bytes +1307 bytes (+1.86%) +1181 bytes
70407 bytes +221 bytes (+0.31%) +95 bytes
70397 bytes +211 bytes (+0.30%) +85 bytes
70420 bytes +234 bytes (+0.33%) +108 bytes
70420 bytes +234 bytes (+0.33%) +108 bytes
70385 bytes +199 bytes (+0.28%) +73 bytes
70312 bytes +126 bytes (+0.18%)

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 54922 bytes -15264 bytes (-21.75%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 60692 bytes -9494 bytes (-13.53%)
LZMA2 (Wikipedia) xz xz -9 62088 bytes -8098 bytes (-11.54%)
Brotli (Wikipedia) brotli brotli -q 11 62255 bytes -7931 bytes (-11.30%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 62839 bytes -7347 bytes (-10.47%)
Zstandard (Wikipedia) zstd zstd -19 67407 bytes -2779 bytes (-3.96%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 68149 bytes -2037 bytes (-2.90%)

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.