Data Representation

A bit is the smallest unit of data a computer can hold: a single 0 or 1, physically stored as one of two voltage levels inside the RAM and CPU registers the first topic in this series already introduced. Eight bits grouped together form a byte, the basic unit files and memory are actually measured in, which is why a file's size on disk — something covered in the previous topic's discussion of storage — is reported in bytes, kilobytes, or megabytes rather than in raw bits. Binary is the base-2 number system those bits literally are: just as a decimal digit can be 0 through 9, a binary digit (bit) can only be 0 or 1, so a byte like `01001101` represents a number built the same way a decimal number is, just using powers of 2 instead of powers of 10, giving a single byte a range of 256 distinct values. Hexadecimal is a base-16 shorthand that exists purely for human convenience: because exactly 4 bits can represent 16 different values (0 through 15, written as 0-9 then A-F), two hex digits map perfectly onto one byte, which is why memory addresses, color codes, and other raw byte values are almost always written in hex instead of binary — it says exactly the same thing in a fraction of the digits. Text encoding is the agreement that assigns a specific byte pattern to each character: ASCII, an early standard, used a single byte per character and covered the basic English alphabet, digits, and punctuation, while Unicode extends that idea to every writing system in the world, with UTF-8 as the most common encoding, using one byte for ordinary English text and more bytes only when a character actually needs them. An integer is a whole number stored in a fixed number of bits — commonly 32 or 64 — with that fixed width creating a real, hard boundary: once a calculation pushes a value past the largest number that width can hold, it wraps back around to a very small or negative number instead of growing further, a bug called integer overflow. A floating-point number represents values with a fractional part, using a standard called IEEE 754 that splits the available bits between the number's sign, its magnitude, and its precision — and because that precision is itself limited, a floating-point value is frequently a close approximation rather than an exact value, which is the well-known reason `0.1 + 0.2` computed on a real computer does not exactly equal `0.3`. All five of these ideas describe the exact same underlying bits interpreted in different ways: the identical byte can be read as a small integer, as two hex digits, as a character, or as part of a larger floating-point number, and which interpretation is correct depends entirely on what the program using it has been told to expect.

A bit: a single 0 or 1
one voltage state, held in RAM or a CPU register
8 bits grouped into a byte
the basic unit files and memory are measured in
Binary / hex
the byte read as a number, in base 2 or base 16
Text encoding
the byte pattern mapped to a character
Integer
a whole number, within a fixed-width range
Floating-point
a fractional number, by IEEE 754
Same bits, different meaning
correct interpretation depends entirely on what the program expects
One Byte, Read as Binary and as Hex 4 bits map exactly onto one hex digit 0 1 0 1 1 1 0 1 first 4 bits = hex digit last 4 bits = hex digit 01011101 in binary = 5D in hexadecimal = 93 in decimal this one byte could equally be read as the character ']' under ASCII/UTF-8 — same bits, a program just has to pick one meaning
Fixed Width Has a Breaking Point Integers wrap around; floating-point rounds Integer overflow an 8-bit unsigned integer holds 0 through 255 255 + 1 = 0 it silently wraps back around a 64-bit integer has the same limit, just much larger Floating-point rounding IEEE 754 splits bits between sign, magnitude, and precision 0.1 + 0.2 != 0.3 the exact decimal value often cannot be stored precisely both are consequences of the same fact: a fixed number of bits can only represent a finite set of exact values, never every real number

Take data representation further

Ask the copilot about this term, or have our engineers assess it against your process.