Bits and Bytes Explained
A clear, short guide that explains what bits and bytes are, how they form data, and why they matter in networking.
What are bits and bytes?
A bit is the smallest unit of digital information. It can be either 0 or 1. In electronic terms it is a low or high voltage, a light pulse, or a magnetic polarity. A byte groups eight bits together. The grouping is fixed in almost all modern computers. One byte can represent 256 different values because 2⁸ = 256. Those values are used to encode characters, numbers, colours, and many other kinds of data.
How bits and bytes are used in networking
When a device wants to send data over a network it first converts the information into a stream of bits. The bits travel across the physical medium – copper wire, fibre-optic cable, or radio – as voltage changes, light pulses, or electromagnetic waves. The receiving device groups the incoming bits into bytes so it can reconstruct the original message. This process is called serialization at the sender and deserialization at the receiver.
Networking protocols define the size of each field in the bit stream. For example, an IPv4 address occupies 32 bits, which is four bytes. A TCP port number uses 16 bits, or two bytes. A MAC address uses 48 bits, or six bytes. By agreeing on the size of each field, devices can parse the stream correctly and route the data to the right place.
Binary representation of numbers and characters
Every number can be written in binary using only 0s and 1s. The binary system is base-2, unlike the decimal system which is base-10. To write the decimal number 13 in binary, we find the highest power of two that fits: 8 (2³). Subtract 8 from 13, leaving 5. The next power is 4 (2²). Subtract 4, leaving 1. The remaining powers are 2 (2¹) which is not needed, and 1 (2⁰) which is needed. The binary pattern becomes 1101. Adding leading zeros to make a full byte gives 00001101.
Characters are also stored as bytes. The ASCII code for the letter "A" is 65 decimal, which is 01000001 in binary. The letter "a" is 97 decimal, or 01100001. Unicode extends this idea to many more symbols, but the basic principle – a character is a number, a number is a pattern of bits – stays the same.
Worked example: sending a short text
Suppose a student wants to send the word “Hi” from a laptop to a phone. In ASCII, “H” is 72 decimal, which is 01001000 in binary. “i” is 105 decimal, which is 01101001. Together they form 16 bits, or two bytes.
- The laptop writes the two bytes to the network interface.
- The interface turns each bit into a voltage change on the Ethernet cable (or a light pulse on fibre).
- The phone’s interface detects the changes and rebuilds the two bytes.
- The phone translates the bytes back to characters and displays “Hi”.
The whole exchange uses only 16 bits of payload. In a real packet additional bits are added for addressing, error checking, and control, but the core data remains the same two bytes.
Transmission speed and bit rate
Bit rate is the number of bits transmitted per second, usually expressed in bits per second (bps). A 100 Mbps Ethernet link can move 100 million bits each second. Because a byte is eight bits, the same link can move 12.5 million bytes per second. Understanding the relationship helps students estimate how long a file will take to download.
If a 2 MB (megabyte) file is transferred over a 10 Mbps link, the raw transfer time is:
2 MB = 2 × 10⁶ bytes = 16 × 10⁶ bits
Time = 16 × 10⁶ bits ÷ 10 × 10⁶ bits/s = 1.6 seconds
In practice, protocol overhead and network congestion add extra time, but the calculation shows the basic role of bits and bytes in performance.
Error detection using bits
Networks often add extra bits for error detection. The most common method is a checksum. The sender adds up all the bytes in the payload, discards overflow, and stores the result in a checksum field. The receiver performs the same addition. If the two checksums differ, the receiver knows an error occurred.
A more robust method is the Cyclic Redundancy Check (CRC). CRC treats the data as a long binary number and divides it by a predefined polynomial. The remainder becomes the CRC value. Because the division is done in binary, the operation uses only bitwise shifts and XORs, which are fast for hardware.
Both techniques rely on the fact that bits can be combined mathematically, and that a single flipped bit will usually change the result dramatically.
Common beginner mistakes
- Counting bits incorrectly – New learners often think a byte is nine bits because of a start-stop bit used in serial communication. In networking a byte is always eight bits; start-stop bits belong to a different layer.
- Confusing bits with bytes – Saying “the file is 500 bits” when it is actually 500 bytes leads to a 4000-fold size error.
- Ignoring endianness – Some assume the most significant byte comes first on every system. In practice, network protocols use big-endian order, while many computers store numbers in little-endian order. Forgetting to convert can scramble the data.
- Assuming all characters fit in one byte – Unicode characters outside the basic ASCII range need two or more bytes. Treating each character as a single byte will truncate or corrupt the text.
Real-world textbook examples
Bitmap colour representation – A simple bitmap stores each pixel as three bytes: one for red, one for green, one for blue. If a picture is 200 × 150 pixels, it needs 200 × 150 × 3 = 90 000 bytes, or 720 000 bits. The fixed size of a byte makes the calculation straightforward.
Maximum IPv4 packet size – The IPv4 header contains a 16-bit field called “Total Length”. Because the field can hold values from 0 to 65 535, the largest packet a device can declare is 65 535 bytes, which is 524 280 bits. This limit is a direct consequence of the 16-bit field size.
Audio sampling – CD-quality audio uses 16-bit samples for each channel. Two channels (stereo) mean 32 bits per sample instant. At a sampling rate of 44 100 samples per second, the raw bit rate is 44 100 × 32 = 1 411 200 bits per second, or about 176 KB/s. Again, the relationship between bits and bytes determines storage and bandwidth needs.
Practical tip for students
When you look at a network packet in a packet-capture tool, you will see a column of hexadecimal values. Each pair of hex digits represents one byte (8 bits). Converting a hex pair to binary is easy: 0 → 0000, 1 → 0001, …, F → 1111. Practicing this conversion helps you see how the abstract bits become the concrete numbers you read on screen.
Check yourself
What is the decimal value of the binary byte 01101101? Answer: 109.
How many bits are needed to represent the decimal number 255? Answer: 8 bits (one byte).
If a network frame carries 1500 bytes of payload, how many bits of payload does it contain? Answer: 12 000 bits.
Further reading
For a broader view of how data moves beyond a single device, see the section on cloud computing in the Relay course. It explains how remote servers store and forward the same streams of bits and bytes.
- networking
- bits
- bytes
- computer-science