What Is a Byte?
A byte is a unit of digital data made of 8 bits, which together can represent 256 different values, from 0 to 255. On most computers it is the smallest unit of memory with its own address, and file sizes are counted in bytes.
Updated September 24, 2026
- 48H
- 69i
- 20␣
- F0 9F 98 80😀
4 characters, 7 bytes
The letter A, stored on your computer, is the number 65, and the number 65 is stored as eight bits: 01000001. That group of eight is a byte. Memory addresses count bytes, file sizes count bytes, and almost every data type in a programming language is a whole number of bytes long.
Why a byte is 8 bits
The word "byte" was coined by Werner Buchholz in 1956, while he worked on IBM's Stretch computer. He spelled it with a y so it would not be misread as "bit". Early computers used groups of different sizes, often 6 bits, which was enough for capital letters and digits but not lowercase.
IBM's System/360, released in 1964, used 8-bit bytes, and the rest of the industry followed. Eight bits give 256 values, which is room for upper and lowercase letters, digits, punctuation and control codes. Eight is also a power of two, so a byte splits evenly into two halves of 4 bits, each written as one hexadecimal digit. Networking standards still say "octet" when they need to be precise that they mean exactly 8 bits.
What one byte can hold
A byte has 256 possible patterns, from 00000000 to 11111111. Programs read them in a few standard ways:
- as an unsigned number from 0 to 255;
- as a signed number from -128 to 127;
- as one character, such as
A(65) or!(33); - as two hexadecimal digits, from
00toFF.
Python's bytes type is a sequence of these values, and it refuses anything outside 0 to 255:
b'Hi!'
[72, 105, 33]
01001000 48
ValueError: bytes must be in range(0, 256)
Not every character fits in one byte. UTF-8, the encoding used by most of the web, stores the 128 ASCII characters in 1 byte each and everything else in 2 to 4 bytes:
A 1 bytes: [65] 41
é 2 bytes: [195, 169] c3a9
€ 3 bytes: [226, 130, 172] e282ac
😀 4 bytes: [240, 159, 152, 128] f09f9880
That is why the length of a string in characters and its size in bytes can differ.
Bit vs byte
A bit is a single 0 or 1. A byte is 8 bits. The two units are easy to confuse because their symbols differ only in case:
| Bit | Byte | |
|---|---|---|
| What it is | One binary digit | 8 bits |
| Possible values | 2 (0 or 1) | 256 (0 to 255) |
| Symbol | b (lowercase) | B (uppercase) |
| Usually measures | Network speed: Mbps, Gbps | Storage and file size: KB, MB, GB |
| Example | A 100 Mbps connection | A 5 MB photo |
To turn bits into bytes, divide by 8. A 100 Mbps connection moves 12.5 MB per second at most, so a 5 MB photo takes at least 0.4 seconds to download on it.
Kilobytes, megabytes and gigabytes
Larger units come in two systems, and the gap between them is why a new drive looks smaller in Windows than on its label.
| Decimal (SI) | Bytes | Binary (IEC) | Bytes |
|---|---|---|---|
| kilobyte (kB) | 1,000 | kibibyte (KiB) | 1,024 |
| megabyte (MB) | 1,000,000 | mebibyte (MiB) | 1,048,576 |
| gigabyte (GB) | 1,000,000,000 | gibibyte (GiB) | 1,073,741,824 |
| terabyte (TB) | 1,000,000,000,000 | tebibyte (TiB) | 1,099,511,627,776 |
Drive makers, network speeds and macOS (since version 10.6 in 2009) use the decimal units. RAM sizes and Windows use the binary units, but Windows labels them KB, MB and GB. The IEC introduced the names kibibyte, mebibyte and gibibyte in 1998 to end the confusion, though many programs still do not use them.
1.0 TB (decimal, used on the box)
931.3 GiB (binary, what Windows calls GB)
12.5 MB per second
No space is missing. The drive holds the trillion bytes the box promises; Windows divides by 1,024 three times instead of 1,000.
Bytes in code
Every value in memory occupies a whole number of bytes. In C, sizeof reports that number. A char is exactly 1 byte by definition, and on current 64-bit Linux, macOS and Windows systems a short is 2 bytes, an int 4 and a double 8. An array of 1,000 int values therefore takes 4,000 bytes.
printf("%zu\n", sizeof(int)); /* prints 4 */
Java's byte type is always signed, from -128 to 127, so a value such as 200 does not fit:
byte b = (byte) 200; // b is -56: the same 8 bits, read as signed
Raw data such as images, compressed files and network packets is handled as an array of bytes: bytes and bytearray in Python, byte[] in Java, Uint8Array in JavaScript. Opening a file in Python with mode "rb" gives you its bytes instead of text.
Hashes and checksums are measured in bytes too. A SHA-256 digest is 32 bytes, which is why it prints as 64 hexadecimal characters, and a CRC32 checksum is 4 bytes. The hash generator shows both for any text.
Where to go next
For the unit underneath the byte, read what a bit is, and for how bytes are used to detect damaged files, what a checksum is. The number base converter turns any byte between decimal, binary and hexadecimal, and the C data types guide lists the size of every C type in bytes.
Frequently Asked Questions
What is 8 bits 11111111 called?
11111111 is a byte with every bit set to 1. Read as an unsigned number it is 255, the largest value a byte can hold, written FF in hexadecimal. Read as a signed byte in two's complement, the same bits mean -1.Why is 8 bits equal to 1 byte?
Why are 4 bits called a nibble?
Is 1 byte 4 bits?
Which is bigger, bytes or GB?
What does one byte look like?
01000001. That pattern is the number 65, which is also the code for the letter A in ASCII. Programmers usually write a byte as two hexadecimal digits instead, so 01000001 becomes 41.