A prime gap is the space between two consecutive prime numbers. If one prime is followed by the next prime, the difference between them tells us how many steps separate them on the number line.
Definition
If pn is the nth prime number and pn+1 is the next prime after it, then the prime gap is the difference between those two primes.
Prime Gap Formula
gn = pn+1 − pn
For example, the primes 11 and 13 are consecutive primes, so the gap is 13 − 11 = 2.
What Prime Gaps Measure
Prime gaps measure the spacing between primes, not the number of composite numbers only. A gap of 2 means the primes are separated by one integer between them. For 11 and 13, that integer is 12.
The first prime gap is unusual: 3 − 2 = 1. After that, every gap between consecutive primes is even, because all primes greater than 2 are odd.
| Consecutive Primes | Calculation | Prime Gap | Numbers Between Them |
|---|---|---|---|
| 2 and 3 | 3 − 2 | 1 | None |
| 3 and 5 | 5 − 3 | 2 | 4 |
| 5 and 7 | 7 − 5 | 2 | 6 |
| 7 and 11 | 11 − 7 | 4 | 8, 9, 10 |
| 11 and 13 | 13 − 11 | 2 | 12 |
| 13 and 17 | 17 − 13 | 4 | 14, 15, 16 |
| 23 and 29 | 29 − 23 | 6 | 24, 25, 26, 27, 28 |
How a Prime Gap Is Found
To find a prime gap, first identify two consecutive prime numbers. Then subtract the smaller prime from the larger prime. The word consecutive matters: 7 and 13 are both prime, but they are not consecutive because 11 lies between them.
Example
The primes around 20 are 19 and 23. Since there is no prime between them, they are consecutive primes. The gap is 23 − 19 = 4.
Checking whether numbers inside a gap are prime is part of the process. You can use PrimeOrNot’s prime number checker to test a number and see whether it is prime, composite, or neither.
Test a Number Around a Prime Gap
Enter a whole number and check whether it is prime before comparing it with nearby primes.
Why Prime Gaps After the First Are Even
Every prime number greater than 2 is odd. The difference between two odd numbers is always even, so every prime gap after the first one is even.
Odd Prime Difference
odd − odd = even
That is why gaps such as 2, 4, 6, 8, 10 and larger even values appear between consecutive primes.
This does not mean every even number appears as a prime gap in a simple pattern. Prime gaps are irregular, and their behavior is one reason prime numbers are studied deeply in number theory.
Twin Primes and Prime Gaps
A prime gap of 2 creates a pair of twin primes. Examples include 3 and 5, 5 and 7, 11 and 13, and 17 and 19.
| Gap Type | Meaning | Example |
|---|---|---|
| Gap of 1 | Only happens between 2 and 3 | 2, 3 |
| Gap of 2 | Creates a twin prime pair | 11, 13 |
| Gap of 4 | Consecutive primes differing by 4; the pair is also a cousin-prime pair | 13, 17 |
| Gap of 6 | Consecutive primes with a difference of 6 | 23, 29 |
| Large gap | A long stretch of composite numbers between consecutive primes | 89, 97 |
Prime Gaps Get Larger, But Not Smoothly
As numbers grow, primes become less dense on average. The average distance between consecutive primes therefore grows, although individual gaps remain irregular.
The average spacing near a large number x is roughly related to log x, a natural logarithm term that appears in the Prime Number Theorem. This is an average idea, not a rule for predicting the next exact gap.
Common Confusion
A larger number does not guarantee a larger next prime gap. Small gaps can still appear among large primes, and larger gaps can appear earlier than expected. Prime gaps are uneven.
Prime Gaps Have No Fixed Upper Bound
Prime gaps do not stay below one fixed limit. There are stretches of composite numbers as long as we want.
One standard way to see this uses factorials. For a large whole number N, the numbers N! + 2, N! + 3, N! + 4 and so on up to N! + N are all composite, because each one is divisible by its added number.
Math Note
The factorial argument shows that arbitrarily long runs of composite numbers exist. It does not tell us the exact location of the next record prime gap, but it proves that prime gaps can become arbitrarily large.
2026 Prime Gap Records and Search Milestones
A maximal prime gap is a prime gap larger than every prime gap that occurs before it. It is a specific record category, so a maximal-gap record should not be confused with every other way prime gaps can be compared.
2026 Maximal-Gap Record
The current record list contains 85 maximal prime gaps. The newest record has length 1,854. In precise terms, the largest known maximal prime gap currently recorded is 1,854.
The word maximal matters here. Calling 1,854 simply the “largest known prime gap” would mix different types of records. Prime gaps can also be ranked by merit, which compares the size of a gap with the average prime spacing near its location. Merit records are tracked separately from the sequence of maximal prime gaps.
Search coverage also advanced during 2026. In February, the upper bound of exhaustive prime-gap analysis reached 266. On May 8, 2026, that boundary was extended to 1020.
Maximal Gap
1,854 is the largest known maximal prime gap currently recorded.
Record Sequence
The current list contains 85 maximal prime-gap records.
Exhaustive Analysis
The analyzed upper bound reached 1020 on May 8, 2026.
GPU-based prime-gap search code has been used to find three new maximal gaps with lengths 1,676, 1,724, and 1,854. The 1,854 result is the newest entry at the top of the maximal-gap sequence.
Prime Gaps and Prime Density
Prime density describes how often prime numbers appear in a region of the number line. Near small numbers, primes are frequent. Farther out, they become thinner on average.
Small Numbers
Prime gaps are often short, such as 2 or 4.
Large Numbers
Prime gaps can be much longer, although short gaps can still appear.
Prime Counting
The prime counting function counts how many primes are less than or equal to a given number.
Why Prime Gaps Matter
Prime gaps connect simple arithmetic with deeper questions about how primes are distributed. They also help explain why prime numbers can feel regular in some places and unpredictable in others.
FAQ About Prime Gaps
What Is a Prime Gap?
A prime gap is the difference between two consecutive prime numbers. For example, the gap between 17 and 19 is 2.
What Is the Smallest Prime Gap?
The smallest prime gap is 1, between 2 and 3. After that, prime gaps between consecutive primes are even.
Why Are Prime Gaps After the First Even?
All primes greater than 2 are odd. The difference between two odd numbers is even, so every prime gap after 2 and 3 is even.
What Prime Gap Creates Twin Primes?
A gap of 2 creates twin primes. Examples include 11 and 13, 17 and 19, and 29 and 31.
Can Prime Gaps Become Very Large?
Yes. There is no fixed largest possible prime gap. Factorial reasoning shows that arbitrarily long runs of composite numbers exist.
What Is a Maximal Prime Gap?
A maximal prime gap is a gap larger than every prime gap before it. The largest known maximal prime gap currently recorded has length 1,854.
Do Prime Gaps Follow a Simple Pattern?
No. Prime gaps have average trends, but the exact spacing between nearby primes does not follow a simple repeating pattern.