Glossary / Mining & consensus
Difficulty adjustment
Also known as Retarget.
- Definition
- The difficulty adjustment is the rule that resets how hard mining is every 2,016 blocks, pulling the average time between blocks back toward ten minutes as hash rate changes.
Bitcoin has no scheduler, so the only way to hold issuance on pace is to make the search harder when miners arrive and easier when they leave. The recalculation lands every 2,016 blocks, targets 1,209,600 seconds of elapsed time, and can move by at most a factor of four. That is why confirmation times survive a mining boom or a crash.
How it works
The difficulty adjustment is arithmetic, not a decision, and every node performs it independently.
At the end of each 2,016 block window, a node reads two timestamps: the one in the first block of the window and the one in the last. It divides the elapsed seconds by 1,209,600, the number of seconds in two weeks, and multiplies the old target by that ratio. Blocks that came in fast produce a ratio below one, which lowers the target and makes the next window harder. Blocks that came in slow produce a ratio above one, which raises the target and makes the next window easier. The result is clamped at both ends: the elapsed time is treated as no less than 302,400 seconds and no more than 4,838,400 seconds, so a single retarget can never move by more than four times in either direction.
There is a famous off-by-one in that calculation. A window of 2,016 blocks contains only 2,015 intervals between them, and the code measures the timestamps without correcting for it. The effect is small and permanent: the network aims for a block every 9.9950 minutes rather than every 10, so bitcoin's clock runs slightly ahead of a naive ten minute schedule. It has never been fixed, because fixing it would be a hard fork for no real benefit.
Timestamps are the weak input, and the rules around them are deliberately loose. A block's timestamp only has to be greater than the median of the previous eleven blocks and no more than two hours ahead of the receiving node's own clock. Miners therefore have a small amount of room to nudge a retarget, which is the basis of the theoretical time warp attack and the reason proposals to tighten timestamp rules keep coming back.
The first adjustment happened on December 30, 2009 at block 32,256, when difficulty rose from 1 to 1.18. Everything since is the same short piece of arithmetic, applied roughly every two weeks.
Why this matters when you buy bitcoin
The difficulty adjustment is why a bitcoin withdrawal has a knowable waiting time, and why mining offers should be read with suspicion.
Between retargets, difficulty is frozen while hash rate moves freely, so block intervals drift. If a large slice of the network switches off, blocks slow down, and a withdrawal that normally clears in half an hour takes noticeably longer until the next adjustment restores the pace. That is not the exchange stalling you. It is the network running below the hash rate the current difficulty was set for, and it self-corrects within 2,016 blocks.
It also caps how much damage one government can do. When China outlawed mining in 2021, more than half the network went dark within weeks, and the protocol absorbed it without a meeting: difficulty fell, blocks sped back up, and machines were shipped to Kazakhstan, the United States, and elsewhere. The country guides on this site show the political side of the same story, where a ban changes who mines and where you can legally buy, but never whether blocks keep coming.
Finally, be skeptical of any product quoting fixed mining returns. Difficulty has trended upward over almost every multi-year period, which means the coins a given machine earns fall over time even if nothing else changes. A cloud mining contract promising a steady daily payout is promising something the protocol works against.
The July 2021 retarget, the largest drop on record
Block 689,472, mined on July 3, 2021, carried the biggest downward adjustment in bitcoin's history: difficulty fell by 27.94 percent in a single step.
The cause was political rather than technical. China's mining ban had dragged the seven day average hash rate from about 136 exahashes per second in mid June to roughly 85 exahashes, a fall of around 35 percent. Because difficulty had been set for the larger network, blocks in that window arrived well behind schedule. The retarget cut the requirement by nearly 28 percent, block times snapped back toward ten minutes, and issuance continued on the same curve. Four consecutive negative adjustments over that period removed roughly 45 percent of difficulty in total, and the network never paused.
That episode is the strongest single argument for the mechanism. No committee voted, no emergency patch shipped, and no user had to do anything at all.
Difficulty adjustment vs difficulty
Difficulty is the number; the difficulty adjustment is the event that changes it. Difficulty is a plain ratio saying how much harder the current search is than the easiest one the rules allow, and it does not drift on its own. The adjustment is the recalculation that sets a new value for the next 2,016 blocks. Charts labeled "difficulty" look like a staircase for exactly this reason: the value is flat inside an epoch and only steps at a retarget.
Difficulty adjustment vs halving
The difficulty adjustment changes how hard it is to find a block; the halving changes how much finding one pays. They run on separate clocks, 2,016 blocks against 210,000 blocks, and they never coordinate. A halving cuts miner revenue overnight, and any shutdowns that follow show up as lower difficulty a few weeks later, but the two rules do not see each other in code. Conflating them is where the phrase "difficulty halving" comes from, and no such event exists.