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

After GZIP compression these minified files vary in size:
Boot
  58756 bytes (57.4k)
CDN
jsdelivr
  58756 bytes (57.4k)
CDN
cdnjs
  51848 bytes (50.6k)
CDN
unpkg
  51567 bytes (50.4k)
CDN
gzip -6 (default)
  51475 bytes (50.3k)
local copy
cdnhttps
  51460 bytes (50.3k)
CDN
gzip -9
  51316 bytes (50.1k)
local copy
libdeflate -12
  49615 bytes (48.5k)
local copy
7zip -mx=9 -tgzip
  49555 bytes (48.4k)
local copy
pigz -11 -n
  49376 bytes (48.2k)
local copy
kzip -s0 -rn -b8
  49331 bytes (48.2k)
local copy
Zopfli
  49285 bytes (48.1k)
local copy
Zopfli (defluff)
  49283 bytes (48.1k)
local copy

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

You will automatically get the smallest D3 3.4.12 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 2175 bytes by using my D3 3.4.12 Zopfli version instead of the best available CDN (4.41% smaller than cdnhttps, 49285 vs. 51460 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 --mls128 --bsr22 --lazy --ohh

(found December 22, 2015)
Description Value Parameter
iterations 100000  --i100000
maximum blocks 8  --mb8
maximum length score 128  --mls128
block splitting recursion 22  --bsr22
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 (49283 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.4.12/d3.min.js --location | md5sum
33889e2dfef992d6fd2acfbe3d42f675  -
curl --silent --compressed http://minime.stephan-brumme.com/files/d3/d3-3.4.12.min.zopfli.js.gz | md5sum
33889e2dfef992d6fd2acfbe3d42f675  -

SHA1:
curl --silent --compressed https://raw.githubusercontent.com/mbostock/d3/v3.4.12/d3.min.js --location | sha1sum
020fb57bcb283559ba58dac1d9caf542f7239f6e  -
curl --silent --compressed http://minime.stephan-brumme.com/files/d3/d3-3.4.12.min.zopfli.js.gz | sha1sum
020fb57bcb283559ba58dac1d9caf542f7239f6e  -

All listed CDNs deliver identical contents:
CDN Size (compressed) MD5 (uncompressed) Timestamp
Boot 58756 bytes 33889e2dfef992d6fd2acfbe3d42f675 (invalid)
jsdelivr 58756 bytes 33889e2dfef992d6fd2acfbe3d42f675 (invalid)
cdnjs 51848 bytes 33889e2dfef992d6fd2acfbe3d42f675 (invalid)
unpkg 51567 bytes 33889e2dfef992d6fd2acfbe3d42f675 July 11, 2016 @ 16:31
cdnhttps 51460 bytes 33889e2dfef992d6fd2acfbe3d42f675 December 24, 2015 @ 07:33

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

Other Versions

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

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
49285 bytes -8 bytes zopfli --i100000 --mls128 --bsr22 --lazy --ohh December 22, 2015 @ 16:22
49293 bytes -1 byte zopfli --i10000 --mls128 --bsr22 --lazy --ohh October 13, 2015 @ 19:54
49294 bytes -7 bytes zopfli --i10000 --mls128 --bsr17 --lazy --ohh October 13, 2015 @ 19:44
49301 bytes -4 bytes zopfli --i1000 --mls128 --bsr17 --lazy --ohh September 20, 2015 @ 23:04
49305 bytes -2 bytes zopfli --i1000 --mls128 --bsr11 --lazy --ohh September 19, 2015 @ 05:17
49307 bytes -7 bytes zopfli --i1000 --mls128 --bsr4 --lazy --ohh September 19, 2015 @ 05:15
49314 bytes -17 bytes zopfli --i1000 --mls32 --bsr12 --lazy --ohh September 19, 2015 @ 05:08
49331 bytes -3 bytes zopfli --i1000 --mls32 --bsr11 --lazy --ohh September 19, 2015 @ 05:08
49334 bytes zopfli --i100 --mls128 --bsr4 --lazy --ohh September 18, 2015 @ 20:08

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

Most recent activity on February 24, 2017 @ 07:48.

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
49450 49498 49431 49442 49402 49434 49446 49449 49446 49439 49523 49524 49534 49528 49535
49448 49421 49330 49334 49342 49336 49303 49398 49381 49374 49383 49383 49527 49395 49385
49383 49421 49333 49378 49315 49342 49337 49401 49380 49379 49372 49403 49367 49385 49375
49344 49449 49473 49361 49340 49337 49344 49390 49377 49368 49370 49389 49522 49375 49381
49441 49426 49333 49346 49364 49358 49363 49418 49377 49400 49525 49395 49520 49383 49521
49404 49447 49449 49448 49340 49334 49383 49397 49380 49376 49388 49388 49522 49369 49377
49447 49446 49335 49355 49317 49330 49342 49394 49377 49372 49371 49374 49520 49381 49377
49443 49451 49335 49357 49322 49331 49299 49396 49378 49376 49382 49386 49367 49384 49373
49353 49439 49335 49352 49306 49324 49321 49390 49379 49383 49367 49366 49522 49371 49372
49435 49423 49372 49352 49373 49330 49319 49380 49367 49370 49379 49368 49520 49365 49375
49431 49433 49329 49362 49326 49335 49340 49394 49379 49378 49382 49379 49521 49386 49386
49430 49433 49316 49337 49309 49344 49342 49393 49378 49367 49383 49384 49519 49385 49375
49438 49435 49330 49325 49323 49324 49345 49394 49378 49379 49365 49379 49522 49383 49389
49433 49431 49335 49363 49323 49322 49287 49390 49377 49383 49372 49384 49368 49384 49384
49433 49431 49337 49349 49358 49342 49345 49394 49377 49386 49372 49384 49524 49386 49373
49433 49432 49338 49325 49345 49327 49435 49394 49376 49383 49379 49374 49368 49388 49373
49445 49434 49330 49347 49323 49329 49434 49390 49376 49384 49374 49375 49520 49384 49381
49444 49435 49322 49359 49359 49327 49343 49394 49378 49380 49382 49387 49520 49384 49375
49436 49439 49395 49358 49359 49426 49285 49383 49376 49377 49365 49375 49520 49383 49390
49430 49440 49332 49331 49341 49426 49341 49396 49378 49376 49366 49379 49368 49383 49371
49449 49446 49335 49364 49335 49333 49339 49395 49381 49373 49384 49381 49365 49379 49373
49435 49432 49333 49350 49323 49336 49341 49394 49378 49380 49370 49373 49364 49368 49390
49435 49447 49338 49333 49309 49341 49341 49394 49379 49380 49373 49374 49381 49371 49386

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 49333 bytes 100%
1,000 49301 bytes -32 bytes 100%
10,000 49293 bytes -8 bytes 100%
100,000 49285 bytes -8 bytes 0.58%
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
49555 bytes +270 bytes (+0.55%) +224 bytes
49557 bytes +272 bytes (+0.55%) +226 bytes
49549 bytes +264 bytes (+0.54%) +218 bytes
49492 bytes +207 bytes (+0.42%) +161 bytes
49438 bytes +153 bytes (+0.31%) +107 bytes
49447 bytes +162 bytes (+0.33%) +116 bytes
49352 bytes +67 bytes (+0.14%) +21 bytes
49366 bytes +81 bytes (+0.16%) +35 bytes
49331 bytes +46 bytes (+0.09%)

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 39252 bytes -10033 bytes (-20.36%)
RAR (proprietary) RAR rar a -m5 -md64m -mc63:128t -mt1 41723 bytes -7562 bytes (-15.34%)
PPMd (Wikipedia) 7zip 7za a -mx=9 -m0=ppmd 42612 bytes -6673 bytes (-13.54%)
Brotli (Wikipedia) brotli brotli -q 11 44593 bytes -4692 bytes (-9.52%)
LZMA2 (Wikipedia) xz xz -9 45252 bytes -4033 bytes (-8.18%)
Burrows-Wheeler transform (Wikipedia) bzip2 bzip2 -9 47048 bytes -2237 bytes (-4.54%)
ZSTD (Wikipedia) zstd zstd -19 47616 bytes -1669 bytes (-3.39%)

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