If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

IP addresses

The Internet Protocol (IP) is one of the core protocols in the layers of the Internet, as you might guess from its name. It's used in all Internet communication to handle both addressing and routing.
The protocol describes the use of IP addresses to uniquely identify Internet-connected devices. Just like homes need mailing addresses to receive mail, Internet-connected devices need an IP address to receive messages.
When a computer sends a message to another computer, it must specify the recipient's IP address and also include its own IP address so that the second computer can reply.
Diagram of two servers. Server #1 is labeled with IP 216.3.128.12 and server #2 is labeled with IP 24.130.242.17. Arrow goes from server #1 to server #2 with a box that says "TO: 24.130.242.17 FROM:216.3.128.12" and 4 bits 0 1 0 1.

IPv4 addresses

There are actually two versions of the Internet Protocol in use today:
  • IPv4, the first version ever used on the Internet
  • IPv6, a backwards-compatible successor
In the IPv4 protocol, IP addresses look like this:
start text, 74, point, 125, point, 20, point, 113, end text
🔍Try visiting that IP in your browser. Where does it go?
Each IP address is split into 4 numbers, and each of those numbers can range from 0 to 255:
start text, open bracket, 0, negative, 255, close bracket, point, open bracket, 0, negative, 255, close bracket, point, open bracket, 0, negative, 255, close bracket, point, open bracket, 0, negative, 255, close bracket, end text
We write those numbers in decimal, but the computer stores them in binary, like so:
start text, 01010101, space, 01010101, space, 01010101, space, 01010101, end text
Each number can represent 2, start superscript, 8, end superscript values, thanks to the 8 bits. That's also why we often call them "octets."
Overall, that's 2, start superscript, 32, end superscript possible values: 4, comma, 294, comma, 967, comma, 296 possible IPv4 addresses.
That's a lot! But remember, in the beginning, we said there are more than four billion devices connected to the Internet? Well, we're reaching the limit of possible IP addresses. It's time for plan B.

IP v6 addresses

Back when the Internet protocols were first invented, the creators didn't anticipate how popular it would become and that there would eventually be more than 2, start superscript, 32, end superscript devices wanting to connect to the Internet.
When it became obvious in the 1990s that the IPv4 addresses were running out, the IPv6 protocol was proposed with a much longer addressing scheme.
Here's an IPv6 address:
start text, 2001, colon, 0, d, b, 8, colon, 0000, colon, 0042, colon, 0000, colon, 8, a, 2, e, colon, 0370, colon, 7334, end text
Notice the letters in those numbers, like start text, d, end text and start text, b, end text in start text, 0, d, b, 8, end text? Those are hexadecimal numbers, which means that the IPv6 address is much longer than it looks. Let's do some math to see exactly how much longer.
There are 8 hexadecimal numbers, and each number is 4 digits long. The highest value for each number is start text, F, F, F, F, end text, since start text, F, end text is the highest digit in hexadecimal. Thus, the highest address would look like:
start text, F, F, F, F, colon, F, F, F, F, colon, F, F, F, F, colon, F, F, F, F, colon, F, F, F, F, colon, F, F, F, F, colon, F, F, F, F, colon, F, F, F, F, end text
What's start text, F, F, F, F, end text in decimal?
start text, F, end textstart text, F, end textstart text, F, end textstart text, F, end text
16, cubed16, squared16, start superscript, 1, end superscript16, start superscript, 0, end superscript
4096256161
Each start text, F, end text represents 15 in decimal, so that's left parenthesis, 15, times, 4096, right parenthesis, plus, left parenthesis, 15, times, 256, right parenthesis, plus, left parenthesis, 15, times, 16, right parenthesis, plus, left parenthesis, 15, times, 1, right parenthesis: a grand total of 65, comma, 535.
We can also calculate that based on the binary representation of start text, F, F, F, F, end text. Each hexadecimal digit start text, F, end text corresponds to 1111 in binary, so that results in these 16 bits:
start text, 1111, space, 1111, space, 1111, space, 1111, end text
As we discuss in Binary numbers, the highest number that can be represented by n binary digits is 2, start superscript, n, end superscript, minus, 1. That means the binary number above is 2, start superscript, 16, end superscript, minus, 1, which once again equals 65, comma, 535.
Each 4-digit hexadecimal number can range between 0 and 65, comma, 535, so each number can represent 65, comma, 536 unique values—and there are 8 of them!
In total, each IP v6 address is represented by 128 bits, so there are 2, start superscript, 128, end superscript possible IP v6 addresses. That's 340 undecillion:
340, comma, 282, comma, 366, comma, 920, comma, 938, comma, 000, comma, 000, comma, 000, comma, 000, comma, 000, comma, 000, comma, 000, comma, 000
🤔 Imagine a world where we have that many Internet connected devices. What does that look like? How could that much Internet usage make the world better?

🔍 What's your IP address?

One way to find out your computer's IP address is by searching Google for "IP address". Google knows your IP address, since your computer sends a message to the Google computers as soon as it loads google.com.
Your IP address might be different tomorrow than it is today. Each ISP has a range of addresses they can assign, and they might give you a different one of those addresses each time they see your computer pop up on the network. That's called a dynamic IP address.
Switching to a different Wi-Fi network will definitely give you a new IP address, since each Wi-Fi provider has its own range of addresses that it can give out.
Computers that act as servers, like the computers that power Google.com, often have static IP addresses. That makes it easier for computers to quickly send search requests to the Google servers. If you tried out the IP address above, you hopefully found yourself on the Google homepage.
Check your understanding
Identify whether each address below is IPv4, IPv6, or invalid:
IP addressAddress type?
start text, 119, point, 67, point, 44, point, 86, end text
start text, 94, point, 49, point, 190, point, 138, end text
start text, 258, point, 151, point, 50, point, 253, end text
start text, e, 0, f, 8, colon, a, f, 58, colon, e, e, e, 6, colon, 52, b, end text
start text, d, 938, colon, 2, d, a, 7, colon, b, 596, colon, 6, d, 34, colon, 3970, colon, 6789, colon, c, 941, colon, 2340, end text
start text, d, 938, colon, 2, d, a, 7, colon, b, 596, colon, 6, d, 3, colon, 3970, colon, 6789, end text


🙋🏽🙋🏻‍♀️🙋🏿‍♂️Do you have any questions about this topic? We'd love to answer—just ask in the questions area below!

Want to join the conversation?