# Packet

> The small chunk every piece of internet data is cut into before it travels.

- Level: Intermediate
- Topics: Networks
- URL: https://tidbit.legios.com.ar/packet/
- In Spanish: [Paquete](https://tidbit.legios.com.ar/es/packet/)

Nothing travels the internet in one piece. A photo, a web page, a second of a video call: everything is chopped into **packets**, small blocks of roughly 1,500 bytes at most, each sent on its own. A packet has a **header** (sender and destination IP address, ports, a sequence number, a few flags) and a **payload**, the actual slice of data. The receiving side puts the slices back in order.

Cutting data up is what makes the internet work at all. Packets from thousands of conversations share the same cables, interleaved; a router handles each one independently, reading only the header; if one gets lost or corrupted, only that small piece is resent. Two packets of the same file can even take different routes and still arrive, because each one carries the full destination address. This design, called **packet switching**, is the opposite of an old phone call, where a line was reserved end to end.

You meet packets when things go wrong. **Packet loss** is the share of packets that never arrive; a few percent is enough to make a video call stutter or a game lag, because TCP waits and resends. Tools like `ping` and `traceroute` send small test packets to measure latency and see which routers are on the way. Firewalls, VPNs and NAT all work by looking at, rewriting or wrapping packets.

## An analogy

Moving a library by mail. You cannot ship the building, so you box the books, number every box, and the boxes may take different trucks. At the other end you shelve them back in order and ask for any box that went missing.

## Keep in mind

- A packet = header (addresses, ports, sequence number) + payload (the data).
- Packets from many conversations share the same cables; routers forward each one on its own.
- Packet loss, not low bandwidth, is what usually makes calls stutter.
- `ping` and `traceroute` are test packets that measure the path.

## Go deeper

- [What is a packet? (Cloudflare)](https://www.cloudflare.com/learning/network-layer/what-is-a-packet/)
- [Packet (MDN glossary)](https://developer.mozilla.org/en-US/docs/Glossary/Packet)
- [Network packet (Wikipedia)](https://en.wikipedia.org/wiki/Network_packet)

## Related terms

- [Internet](https://tidbit.legios.com.ar/internet/): A worldwide network of networks that lets any connected device reach any other.
- [IP address](https://tidbit.legios.com.ar/ip-address/): The number that identifies a device on a network, like a postal address.
- [Port](https://tidbit.legios.com.ar/port/): The numbered door on a computer that says which program a connection is for.
- [Router](https://tidbit.legios.com.ar/router/): The box that connects your devices to each other and to the internet.
- [TCP and UDP](https://tidbit.legios.com.ar/tcp-and-udp/): Two ways to send packets: TCP checks everything arrives, UDP just sends and moves on.
- [Bandwidth and latency](https://tidbit.legios.com.ar/bandwidth-and-latency/): How much data fits per second, and how long each trip takes. Two different things.
- [Firewall](https://tidbit.legios.com.ar/firewall/): A gatekeeper that decides which network traffic gets in or out.
- [VPN](https://tidbit.legios.com.ar/vpn/): An encrypted tunnel that sends all your traffic through another network first.
