# IP Addresses and Subnets

> What an IP address is and how to read one like 192.168.1.20. What a subnet and /24 mean, and why 127.0.0.1 always means this machine.

**Course:** [Computer Networking](https://learn.benibix.com/learn/infrastructure-networking)  
**Time:** 11 min

**After this lesson you can:**

- Read an IPv4 address
- Say how many addresses a /24 holds
- Explain what localhost is for

## How to read an IP address

An IP address is the number that marks one device on a network. Packets use it to find the device. The common kind is written as four numbers with dots, such as 192.168.1.20. Each number runs from 0 to 255, which allows about 4.3 billion addresses in all.

That is not enough for every phone, laptop and server on Earth. So a newer kind, IPv6, uses much longer numbers, such as 2001:db8::20. There are so many of them that no one will run out. Most networks now carry both kinds side by side.

Addresses come in blocks called subnets. A subnet is written with a slash, such as 192.168.1.0/24. The number after the slash says how much of the address is fixed for the whole block. With /24, the first three numbers stay the same and only the last one changes.

So 192.168.1.0/24 holds 256 addresses, from .0 to .255. The first and the last are kept back for the network itself, which leaves 254 for devices. A /16 fixes only the first two numbers and holds 65,536. A smaller number after the slash means a bigger block.

Devices in the same subnet talk to each other straight away. To reach an address outside the block, they send the packet to the router. So the subnet tells each device which addresses are its neighbours and which are far away.

Every computer also has a name for itself: localhost. Its address is 127.0.0.1. Data sent there never leaves the machine. Coders use it to test a website on their own laptop before anyone else can see it.

People often type a server's private address from outside its network. Then nothing happens. An address like 192.168.1.20 only works inside its own building. The same number is in use in millions of homes at once, and the next lesson shows how.

![The address 192.168.1.20 drawn as four boxes, each marked 0 to 255. A line under the first three boxes says they are the network, the same for every device on it, the first 24 bits. A line under the last box says this device. Below, the subnet 192.168.1.0/24 is shown as 256 addresses from 192.168.1.0 to 192.168.1.255, with 254 devices fitting.](https://learn.benibix.com/diagrams/infc-ip-subnet.svg)

### Example: Emma finds her printer

Emma's laptop has the address 192.168.1.14 and her printer has 192.168.1.30. Both start with 192.168.1, so they are on the same /24.

The laptop sends to the printer directly, without the router. When she opens a website, the laptop sees an address outside 192.168.1. It hands those packets to the router at 192.168.1.1.

**Words in this lesson:** [Internet Protocol Address (IP Address)](https://learn.benibix.com/term/infrastructure/ip-address), [Subnet](https://learn.benibix.com/term/infrastructure/subnet), [Localhost](https://learn.benibix.com/term/infrastructure/localhost)

**Question:** How many devices fit in the subnet 192.168.1.0/24?

**Answer:** 254. A /24 holds 256 addresses. The first is the network's own name and the last is kept for messages to everyone, so 254 are left for devices.

---

Source: https://learn.benibix.com/learn/infrastructure-networking/ip-addresses-and-subnets
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
