Thermodynamics

Maxwell's Demon

A 150-year-old paradox that connects entropy, information, and the thermodynamic cost of computation

Maxwell's demon sorts gas molecules by speed to build a temperature gradient — apparently breaking the second law. Landauer's principle saves it: erasing a bit costs k·T·ln 2 of heat.

  • ProposedMaxwell, 1867 letter to Tait
  • ResolutionLandauer 1961 · Bennett 1982
  • Erasure costk·T·ln 2 per bit
  • At 300 K≈ 2.87 × 10⁻²¹ J/bit (0.018 eV)
  • Szilard engineExtracts k·T·ln 2 per cycle
  • Modern CMOS~10⁻¹⁵ J/switch (Landauer × 10⁶)

Interactive visualization

A two-chamber gas, a tiny gate, and an entity who knows the speed of every molecule. Watch the gradient build — and watch the demon's memory fill up.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

Maxwell's letter

In an 1867 letter to Peter Guthrie Tait, James Clerk Maxwell sketched a "finite being" that could undermine the second law:

"Let us suppose that a vessel is divided into two portions, A and B, by a division in which there is a small hole, and that a being, who can see the individual molecules, opens and closes this hole, so as to allow only the swifter molecules to pass from A to B, and only the slower ones to pass from B to A. He will thus, without expenditure of work, raise the temperature of B and lower that of A, in contradiction to the second law of thermodynamics."

Kelvin coined the term "Maxwell's demon" a few years later. For more than a century the paradox resisted definitive resolution.

Why it's a real paradox

Start with a sealed gas at uniform temperature T. The second law says ΔS_total ≥ 0; the only way to create a hot/cold gradient should be to do work (compress, refrigerate, etc.). But the demon does no work:

  • The door is frictionless and massless.
  • Opening and closing takes negligible energy.
  • The demon's "vision" is merely observation, which seems energetically free.

And yet the gas develops a gradient. Plug the resulting hot/cold reservoirs into a Carnot engine and you've made a perpetual motion machine of the second kind. Something has to give.

Early proposed resolutions (incomplete)

YearProposerIdeaVerdict
1912SmoluchowskiDemon itself fluctuates; thermal noise prevents reliable gatingPartial — fails for sufficiently large demons
1929SzilardBoiled the paradox down to a 1-molecule engine; identified information storage as crucialSet the stage; didn't pinpoint the cost
1951BrillouinDemon must shine a flashlight to see molecules; photon scattering adds entropyPartial — relies on a particular measurement scheme
1961LandauerLogically irreversible operations dissipate k·T·ln 2 per bitFoundation of the modern resolution
1982BennettMeasurement CAN be reversible; ERASURE is what costs k·T·ln 2 per bit; demon's memory eventually fillsThe accepted resolution

Landauer's principle

Logically irreversible operations — any process that takes many input states to fewer output states — must dissipate energy. For the simplest case, erasing 1 bit (mapping 0 or 1 to a fixed 0):

W_erase ≥ k·T·ln 2

At T = 300 K:

k·T ≈ 1.381 × 10⁻²³ J/K × 300 K = 4.14 × 10⁻²¹ J
k·T·ln 2 ≈ 4.14 × 10⁻²¹ × 0.693 = 2.87 × 10⁻²¹ J ≈ 0.018 eV per bit

Equivalent thermodynamic entropy increase per bit: k·ln 2 ≈ 9.57 × 10⁻²⁴ J/K. Erase a full byte at room temperature and you must dump roughly 2.3 × 10⁻²⁰ J as waste heat into the environment.

Landauer's bound was verified experimentally by Bérut et al. in 2012 using a colloidal particle in a double-well optical trap — measured dissipation matched k·T·ln 2 within experimental error.

Bennett's resolution

Charles Bennett's 1982 insight: measurement itself can be made thermodynamically free (reversible) — but the demon must store the measurement results somewhere. As the demon sorts more and more molecules, its memory fills up with bits. Eventually it must reset (erase) the memory to keep operating. Each erasure pays back k·T·ln 2 to the environment.

The accounting closes:

  • Per sorting event: demon gains 1 bit of information, gas entropy decreases by k·ln 2.
  • Per erasure: demon clears 1 bit, environment entropy increases by ≥ k·ln 2.
  • Net: ΔS_total ≥ 0. Second law survives.

The Szilard engine

Leo Szilard distilled the demon down to a single molecule in a box at temperature T:

  1. Insert a frictionless partition in the middle. The molecule is on the left or right — 1 bit of information.
  2. Measure which side. Attach a weight to the partition on the side WITHOUT the molecule.
  3. The molecule pushes the partition isothermally; extract work W = k·T·ln 2 from the heat bath.
  4. Remove the partition; molecule fills the full box again. Reset memory; repeat.

Work extracted per cycle: k·T·ln 2. Memory cost per cycle: k·T·ln 2. Net work: zero. Heat is converted to nothing; the second law is exactly saturated.

Costs at human and machine scale

ScaleEnergy per bit erasedMultiple of k·T·ln 2 at 300 K
Landauer limit (300 K)2.87 × 10⁻²¹ J1
State-of-the-art adiabatic logic (lab)~10⁻¹⁸ J~350
5-nm CMOS transistor switch (2024)~10⁻¹⁵ J~350 000
DRAM cell write~10⁻¹² J~3.5 × 10⁸
HDD bit write~10⁻⁹ J~3.5 × 10¹¹
Human brain synapse fire~10⁻¹³ J~3.5 × 10⁷

Modern computers run 6 to 10 orders of magnitude above the Landauer bound. There's room for orders-of-magnitude improvement before thermodynamics, rather than engineering, becomes the limit.

JavaScript — Landauer and Szilard arithmetic

const k_B = 1.380649e-23;  // J/K
const ln2 = Math.LN2;

// Landauer minimum energy per bit erased
function landauerErase(T) { return k_B * T * ln2; }

console.log(`Erase 1 bit at 300 K: ${landauerErase(300).toExponential(2)} J`);  // 2.87e-21
console.log(`Erase 1 bit at 4 K (LHe): ${landauerErase(4).toExponential(2)} J`);   // 3.8e-23
console.log(`Erase 1 bit at 4 mK (dil. fridge): ${landauerErase(0.004).toExponential(2)} J`);

// Szilard engine work extracted per cycle (single molecule)
function szilardWork(T) { return k_B * T * ln2; }

// Modern transistor vs Landauer ratio
const E_switch = 1e-15;  // ~1 fJ per CMOS switch
console.log(`Headroom factor: ${(E_switch / landauerErase(300)).toExponential(2)}`);  // ~3.5e5

// Bits erased to dump 1 joule (at 300 K)
const bits_per_joule = 1 / landauerErase(300);
console.log(`Bits per joule at 300 K: ${bits_per_joule.toExponential(2)}`);  // ~3.5e20

// Information vs thermodynamic entropy
// Shannon entropy H bits ↔ thermodynamic entropy k·H·ln 2 J/K
function shannonToThermo(H_bits) { return k_B * H_bits * ln2; }
console.log(`Thermo entropy of 1 GB: ${shannonToThermo(8 * 1e9).toExponential(2)} J/K`);  // ~7.6e-14

// Brain energy efficiency check
// ~10^16 synaptic operations per second, 20 W power
const brain_ops = 1e16;
const brain_W = 20;
const energy_per_op = brain_W / brain_ops;  // 2e-15 J
console.log(`Brain energy per op: ${energy_per_op.toExponential(2)} J  (≈ ${(energy_per_op / landauerErase(310)).toExponential(2)} × Landauer)`);

Where the demon and Landauer show up

  • Reversible computing. Bennett and Fredkin showed that logically reversible computation can in principle dissipate zero energy per logical step. Adiabatic CMOS prototypes already operate orders of magnitude below conventional CMOS energy.
  • Quantum computing. Unitary gates are reversible — no per-gate Landauer cost. The cost shows up at measurement and at error correction (which throws information away).
  • Molecular machines. ATP synthase, kinesin, and bacterial flagella operate at 20-100% efficiency near the thermodynamic optimum; biology found the Landauer scale long before physics did.
  • Single-electron devices. Experimental "demons" built with single-electron transistors (Aalto, NIST, IBM) have validated Landauer's bound and Sagawa-Ueda generalizations to within experimental error.
  • Black-hole thermodynamics. Bekenstein bound caps the information that can fit inside a region of given area; one bit per 4·ln 2 Planck areas at saturation. Same kT·ln 2 structure.
  • Cryptography. Provably one-way functions can be analyzed via the thermodynamic cost of computing them in reverse — connects security to entropy.

Common mistakes

  • Claiming "the demon needs energy to look". Measurement CAN be made arbitrarily energy-efficient (Bennett 1973). The cost is in erasure, not observation.
  • Conflating Shannon entropy and thermodynamic entropy. They're proportional (S_thermo = k·ln 2 × H_bits) but measured in different units. Don't equate "1 bit" with "1 J/K" — convert.
  • Believing modern computers are at Landauer. Real CMOS is 5-6 orders of magnitude above the limit. There's enormous engineering headroom before fundamental physics bites.
  • Saying the demon is "impossible". Demons HAVE been built — single-molecule and single-electron versions. They obey the second law because their memory operations dissipate at least the Landauer amount.
  • Forgetting that erasure depends on T. k·T·ln 2 scales linearly with environmental temperature. Cryogenic computing dramatically lowers the per-bit limit (3.8 × 10⁻²³ J/bit at 4 K liquid helium).
  • Thinking the demon needs to be conscious. The argument is purely physical — any feedback controller storing measurement bits faces the same entropy accounting. Consciousness is irrelevant.

Frequently asked questions

What exactly does Maxwell's demon do?

It sits at a tiny frictionless door between two gas chambers at the same temperature. When a fast molecule approaches from chamber A it opens the door long enough for the molecule to pass into B; when a slow molecule approaches from B it lets that into A. Over time, B becomes hot and A becomes cold — a temperature gradient appears spontaneously, without any work being done. That would violate the second law of thermodynamics.

Why was the paradox so hard to resolve?

Early attempts focused on the work needed to open the door, friction, or thermal fluctuations of the demon itself. Smoluchowski and Brillouin showed those mechanisms add some entropy but not always enough. The real culprit, found by Bennett in 1982 building on Landauer's 1961 result, is the demon's MEMORY: it must record each molecule's speed before deciding when to open the door. Memory occupies physical bits. To run forever the demon must eventually erase those bits — and erasure has an unavoidable thermodynamic cost.

What is Landauer's principle exactly?

Logically irreversible operations — anything that maps many input states to fewer output states, such as erasing a bit (1 or 0 → 0) — must dissipate at least k·T·ln 2 of heat into the environment per bit erased. At T = 300 K this is about 2.87 × 10⁻²¹ J per bit, roughly 0.018 eV. Modern CMOS transistors dissipate about 10⁻¹⁵ J per switch, 6 orders of magnitude above the Landauer bound, so we have room before computers hit thermodynamic limits.

Has Maxwell's demon actually been built?

Yes — at the single-molecule and single-electron scale. The 2010 Toyabe et al. experiment used a feedback-controlled potential on a colloidal bead to extract about 0.28 k·T of work per measurement, validating the Szilard engine quantitatively. Single-electron transistor demons have been demonstrated at IBM, Aalto, and elsewhere. Each implementation also dissipates more than k·T·ln 2 per cycle when you include the measurement and erasure cost, so the second law survives intact.

How is the Szilard engine related?

Leo Szilard's 1929 simplification used a single molecule in a box. Insert a partition; the molecule is now on one side (a 1-bit measurement). Attach a weight; let the molecule push the partition outward in an isothermal expansion, extracting k·T·ln 2 of work from the heat bath. Remove the partition; repeat. The trick is that the work extracted exactly equals the Landauer cost of erasing the 1 bit of memory at the end — net entropy change zero, second law preserved.

Does information have physical mass or energy?

Information itself is abstract, but storing or erasing it has a physical cost. Landauer's slogan was "information is physical." A bit in equilibrium with the environment has no minimum energy cost to set or read non-destructively; erasing or overwriting it does. The thermodynamic equivalent of one nat of information is k·T joules; one bit is k·T·ln 2 ≈ 0.69 k·T.

How big is k·T·ln 2 at everyday temperatures?

Tiny. k·T at 300 K is about 4.14 × 10⁻²¹ J or 25.7 meV; multiply by ln 2 ≈ 0.693 to get 2.87 × 10⁻²¹ J per bit, about 0.018 eV. Compare to a single ATP hydrolysis (about 0.5 eV) or a green photon (about 2.4 eV). To erase 1 byte at 300 K costs about 2.3 × 10⁻²⁰ J — utterly negligible at human scales, fundamental at the nanoscale.