Skip to main content

Difficulty Adjustment | Bitcoin Glossary | Mapping Bitcoin

Difficulty Adjustment

Mining

Also known as: retarget, difficulty retarget

An automatic recalibration of the mining difficulty that occurs every 2,016 blocks (approximately two weeks). If blocks were mined faster than the 10-minute target, difficulty increases; if slower, it decreases, maintaining a stable block production rate.

Overview

The difficulty adjustment is one of Bitcoin's most elegant mechanisms. Every 2,016 blocks, the protocol automatically recalculates the mining difficulty to keep the average time between blocks close to 10 minutes. This ensures a predictable issuance schedule and consistent transaction processing regardless of changes in total network hash power.

How It Works

At every 2,016th block, each node independently computes the new difficulty using a straightforward formula:

new_difficulty = old_difficulty * (2016 * 10 minutes) / actual_time_for_last_2016_blocks

Example:
- If 2,016 blocks took 13 days instead of 14:
  new_difficulty = old * (20160 min / 18720 min) = old * 1.077
  → Difficulty increases ~7.7%

- If 2,016 blocks took 15 days instead of 14:
  new_difficulty = old * (20160 min / 21600 min) = old * 0.933
  → Difficulty decreases ~6.7%

Safety Limits

To prevent extreme swings, Bitcoin caps each adjustment at a factor of 4 in either direction:

Maximum increase: 4x  (300% increase)
Maximum decrease: 0.25x (75% decrease)

This means even if half the network hash rate suddenly disappears, difficulty can only drop by 75% per adjustment period, and it may take several periods to fully recalibrate.

Why 2,016 Blocks?

The number 2,016 was chosen because it equals exactly two weeks at the 10-minute target rate:

2,016 blocks * 10 minutes = 20,160 minutes = 14 days

This two-week period provides a balance between responsiveness to hash rate changes and stability against short-term fluctuations.

Edge Cases

  • Off-by-one: Due to a known quirk in Bitcoin's code, the calculation actually uses the timestamps of the first and last blocks in the period, measuring only 2,015 block intervals rather than 2,016. This results in a minor systematic bias.
  • Timestamp manipulation: Miners have some latitude in setting block timestamps. To mitigate gaming the difficulty adjustment, Bitcoin enforces rules requiring timestamps to be greater than the median of the previous 11 blocks and not more than 2 hours in the future.
  • Hash rate crashes: If a large portion of miners suddenly go offline, blocks will be produced slowly until the next adjustment. There is no emergency difficulty adjustment in Bitcoin (unlike some other cryptocurrencies).