From bits to molecules: the same equation wearing a different coat
In statistical mechanics, developed by Ludwig Boltzmann, entropy is derived from observing a macrostate – which is a general property of a system, like its temperature, for example, and considering how many microstates correspond to it. A microstate is a certain arrangement of the positions and velocities of each particle in a system. The basic idea is that entropy increases as the number of microstates for a given macrostate does. Calling that number of configurations $\Omega$, we can say that entropy is:
$$S={k}_{B}\text{ln}(\Omega)$$
where ${k}_{B}$ is Boltzmann's constant. Comparing this with the entropy of a uniform distribution over $\Omega$ equally likely microstates, using Shannon's own formula:
$$H=-\sum_{i=1}^{\Omega} \frac{1}{\Omega}{\text{log}}_{2}\frac{1}{\Omega}={\text{log}}_{2}\Omega$$
These are the same expression! Converting the logarithm base and folding in the physical constant, $S={k}_{B}\text{ln}(2)\cdot H$. This is not a loose analogy or a poetic parallel. It is a mathematical identity between two formulas built from the same three axioms, the grouping property in particular, applied once to blocks of coin flips and once to arrangements of gas molecules. Boltzmann's entropy is Shannon's entropy, computed over the distribution of microstates consistent with what you know about a system, and scaled to carry units of joules per kelvin instead of bits.
This identity has a striking consequence. Entropy, in physics as much as in information theory, is not a property of "how messy" a system looks. It is a measure of an observer's ignorance about which exact microstate the system is in, given only a coarse, macroscopic description. A neatly stacked deck of cards has one arrangement consistent with "sorted," so it carries almost no uncertainty and almost no entropy. A shuffled deck has $52!$ arrangements consistent with "shuffled," so it carries enormous uncertainty and high entropy. "Disorder" is simply what a state with very high multiplicity, and therefore very high ignorance, tends to look like to a human eye. It is a convenient visual proxy, not the actual quantity being measured.
Maxwell's demon, and the bill it can't avoid paying
Now for a puzzle. The only law in physics determining that time should go forwards is the Second Law of thermodynamics, which states that the total entropy of the universe must increase over time: dS > 0. But violating this law opens up a whole can of worms and leads to plenty of fundamental questions. Would it mean that time isn't necessarily unidirectional, or does time even exist at all? James Clerk Maxwell came up with a thought experiment to investigate a possible, laws-of-physics-defying scenario.
Imagine a box of gas at uniform temperature, split by a wall with a tiny door. A demon watches molecules approach the door and lets fast ones through to one side only, slow ones through to the other. Given enough time, the demon sorts the gas into a hot half and a cold half, decreasing the gas's thermodynamic entropy over time (while also not increasing the entropy of surroundings) without doing any work, which appears to be a violation of the Second Law!
The resolution, worked out fully by Rolf Landauer and Charles Bennett, rests entirely on the identity between physical and informational entropy established above. Watching a molecule and deciding fast or slow is a measurement, and measurement alone, if the demon's memory simply accumulates fresh correlations without ever being reused, can in principle be done reversibly, at no thermodynamic cost. The trouble starts when the demon's memory is finite, which any physically buildable demon's memory must be. To keep operating, the demon must eventually erase old measurements to make room for new ones.
Erasure is fundamentally different from measurement. Resetting a memory cell to a fixed state, "0," regardless of whether it previously held a 0 or a 1, is a many to one operation. Given the final state, you cannot recover what the input was. This logical irreversibility has a physical price, known as Landauer's bound:
$${E}_{\text{min}}={k}_{B}T\text{ln}(2)$$
per bit erased, dissipated as heat into the surrounding environment. Picture the memory bit as a particle able to sit in either of two wells, left representing 0, right representing 1. Before erasure, both wells are accessible, giving $\Omega=2$ and entropy ${k}_{B}\text{ln}(2)$. Erasure forces the particle into one specific well regardless of where it started, shrinking $\Omega$ down to 1 and the memory's own entropy down to zero. Since the total entropy of memory plus environment cannot decrease, by the second law, the ${k}_{B}\text{ln}(2)$ that vanished from the memory must reappear as heat dissipated into the environment, at a cost of at least ${k}_{B}T\text{ln}(2)$ joules.
Every bit the demon measures and later erases costs at least this much heat. Tally up the full books: the gas's entropy goes down through sorting, but the demon's memory erasure generates at least as much entropy elsewhere, and typically more. The second law survives, once you account for the full physical system, demon included, rather than just the gas in isolation.
Reading the equation two ways at once
It is worth pausing on just how tight this connection really is, because it is easy to read past it as a metaphor when it is really an equality.
The demon's uncertainty about a single molecule's speed, before measuring it, is exactly Shannon's $H\left(p\right)$, the same formula used for the biased coin, with $p$ now standing for the probability a molecule counts as "fast." Measuring the molecule collapses that uncertainty, storing one bit's worth of correlation in the demon's memory. Erasing that memory later costs ${k}_{B}T\text{ln}(2)$ of physical entropy, dumped as heat, per bit stored. The conversion factor between a bit of Shannon entropy and a joule per kelvin of thermodynamic entropy is not an approximation or a rule of thumb. It is ${k}_{B}\text{ln}(2)$, exactly, the same constant that appears when you convert the freely chosen constant $K$ in Shannon's original uniqueness proof into a fixed, physically measured value.
So the full chain reads: a molecule's speed is uncertain, exactly as a coin flip is uncertain, quantified by the same $H\left(p\right)$. Measuring it stores that uncertainty as a correlation in physical memory, at no cost if done reversibly. Reusing that memory, which any finite demon eventually must do, requires erasing the correlation, which is logically irreversible and therefore has an unavoidable thermodynamic price, fixed by Boltzmann's constant and the very same logarithm that defines Shannon's bits. Two branches of physics, one born from telegraph engineering and one from steam engines, turn out to be talking about the same underlying quantity all along.
What this buys you
The clarity we get from taking this connection seriously is that ignorance, not mess, is the right word to reach for whenever entropy comes up. A gas spread evenly across a room is not "more disordered" than a gas crammed in one corner in any fundamental sense. It is a macrostate consistent with vastly more microstates, meaning an observer who only knows the macroscopic description is vastly more ignorant about the exact configuration. The same logic explains why a maximally spread out probability distribution, like a fair coin or a gas at equilibrium, always carries the largest entropy among all distributions with the same constraints: it is the distribution that assumes the least, the one that adds no information beyond what you actually know.
From a biased coin's fractional bits, to the crowd of molecules bouncing inside a box, to a demon's memory forced to pay a thermodynamic toll, one formula keeps reappearing, because one idea keeps reappearing underneath it: entropy measures what you do not know.