Why do numbers in IPv4 addresses only go up to 255?
Recapping IP addresses and CIDRs
In my last post, I said:
The notation we used earlier to describe a range of addresses is called a CIDR block. Since IPv4 addresses have four octets, so do their CIDR blocks.
10.0.0.0/8
, for example, means “every IPv4 address between10.0.0.0
and10.255.255.255
.”
To quickly recap for folks who don’t recognise the terminology, each “part” of an IPv4 address is an octet. We’ll go into the detail of why later.
So, why don’t we ever see octets greater than 255
in IPv4 addresses?
Why don’t we ever see 10.999.999.999
? Heck, why not 10.9999.9999.9999
?
Why do we stop at 255
in each octet?
Numeral systems
A word can be translated between many languages, but it still has the same meaning. “Cat” in English is pusa in Filipino, ネコ in Japanese and పిల్లి in Telugu. The written forms are different, but they all refer to our same little buddies.
Likewise, a number can be translated between many numeral systems, but it always retains the same value.
“But I don’t know any numeral systems!” I hear some of you yell.
Take a deep breath. You’ve got this.
The decimal numeral system
If I asked you to write down the numerals from one to eleven and you scrawled 1
, 2
, 3
, 4
, 5
, 6
, 7
, 8
, 9
, 10
and 11
, then you just used the decimal numeral system.
For most of us, decimal is the cultural default and we don’t need to think about what the numerals mean. If I asked you pass me 23
cookies then you’d… well, I mean… that’s a lot of cookies, but you’d know I meant “twenty three” cookies.
But let’s do some maths to break down the numeral 23
and understand why it has the value that it does. Like, we instinctively know that the 2
really means twenty
, but why?
When we understand how to mine the value of a numeral, we can apply it to other numeral systems to figure out their values too.
We’ll start by putting each digit into a column. The 0
at the front just helps us to demonstrate the maths and doesn’t mean anything; 023
is the same as 23
.
If you’re familiar with decimal then you already know that each position describes a number of “ones”, “tens”, “hundreds”, and so on. We’ll call these “multipliers”.
To work out the actual value of the digit at each position, we multiply the digit by its multiplier.
Finally, we sum (“add together”) the results of the multiplication to get the full numeral’s value.
Unsurprisingly, the decimal value of 23
in decimal is… wait for it… 23
.
Bear with me. We’ll run this process on a lessobvious numeral next.
Binary counting
The reason^{1} why we multiply by ×1
, ×10
, ×100
– and so on – with decimal numerals is because they’re increasing multiples of ten, and it’s no coincidence that the “deci” in “decimal” originates from the Latin prefix for ten.
 The first multiplier is
×1
. Multiply it by10
to get the next multiplier:×10
.  The next multiplier is
×10
. Multiply it by10
to get the next multiplier:×100
.  The next multiplier is
×100
. Multiply it by10
to get the next multiplier:×1,000
.
Now, we want to convert a binary numeral. But what are the multipliers for binary numerals? There’s a clue in the name; “bi” originates from the Latin prefix for two. So, instead of multiplying by ten, we’ll multiply by two.
 The first multiplier is
×1
. Multiply it by2
to get the next multiplier:×2
.  The next multiplier is
×2
. Multiply it by2
to get the next multiplier:×4
.  The next multiplier is
×4
. Multiply it by2
to get the next multiplier:×8
.  The next multiplier is
×8
. Multiply it by2
to get the next multiplier:×16
.
So, let’s make up a binary numeral – say, 10111
– and convert it to our cultural default of decimal by breaking it down and understanding it.
We’ll start by writing in the digits and the multipliers.
And just like last time, we’ll perform the multiplications then sum the results.
And, look! Binary 10111
is decimal 23
.
Same number, different form.
IPv4 addresses and octets
Behind the scenes, an IP address is just a number. A huge number, sure, but just a number.
In fact, IPv4 addresses are 32bit binary numbers.
If we just did a straight conversion of – for example – binary 00110110101100000000110111010010
to decimal, we’d get 917,507,538
. But that’s just a huge number, and we humans don’t get on well with huge numbers.
To make it easier for us biologicals to comprehend, we split the 32bit numeral into four 8bit numerals then convert each one to decimal. Each 8bit chunk is called an octet because “oct” originates from the Latin prefix for “eight”.
There’s no fancy mathematics here; we’re just taking an axe to the big number to make four smaller ones.
So, why is 255 the maximum value of each octet?
So, why does each octet have a maximum value of 255
? Because – drumroll, please – that’s the maximum value that an 8bit number can hold.
That’s why the final address in 10.0.0.0/8
is 10.255.255.255
, and the largest possible IPv4 address is 255.255.255.255
.
And now that you know this, you can thrill your friends and family by pointing out every invalid IPv4 address you see on TV.
If you liked this…
If you liked this post then you’ll love the free book I’m releasing later in 2019 about decimal, binary, and other awesome numeral systems. The book will dive a little deeper than this blog post did, and it’ll have drawings of cats too.
Subscribe to my newsletter below, and I’ll send you a link as soon as the book is available!

Okay, this is slightly simplified for the sake of a shorter blog post. It’s accurate, but simplified. I’ve got an awesome book coming out later this year which goes into more detail on why these numbers are the way they are, and you should totally subscribe to my newsletter so you know when it’s released. ↩