Binary Octal and Hexadecimal
One quantity is written in decimal, binary, octal and hexadecimal using positional weights.
A quantity such as fifty-three can be written in decimal, binary, octal or hexadecimal, and digital hardware switches between these representations constantly. Positional weights make every conversion straightforward: each column is worth the number base raised to that column's position.
Analog Against Digital
An analog signal varies smoothly over a continuous range, while a digital signal takes only discrete levels. A dimmer knob sweeps through every brightness in between, whereas a wall switch has only two states: on and off. Digital hardware commits to two voltage bands and calls them 0 and 1, trading continuous detail for strong noise immunity—a slightly degraded 1 is still read reliably as 1.
A binary digit is called a bit, and place value determines each bit's weight. In any base , columns to the left of the point carry weights outward, and columns to the right carry weights inward. Binary uses base , octal uses , decimal uses , and hexadecimal uses with digits 0–9 followed by A–F for ten through fifteen.
Positional Value of a Number in Base r
Multiply each digit by , where positions run to the left of the point and to the right. For example, . Moving one column to the right always divides the column weight by the base, just as in decimal.
Converting Between Bases
Repeated division by the target base converts integer parts, whereas repeated multiplication converts fractional parts. To convert 25 to binary, divide repeatedly by 2 and record each remainder: , then read the remainders from last to first as . The first remainder is the least significant bit (LSB), and the last is the most significant bit (MSB).
For , multiply repeatedly by 2 and keep each integer part: , read from top to bottom as . Integer and fractional parts convert separately and rejoin at the point.
Octal and hexadecimal act as compact shorthands for groups of three and four bits. Because , each octal digit corresponds to three bits: group outward from the binary point, pad outer groups with zeros if needed, and translate each group.
Because , each hexadecimal digit corresponds to four bits in the same way. Thus groups as and as , while expands back to .
Common hardware units group bits into standard sizes: a nibble is 4 bits (one hexadecimal digit), a byte is 8 bits, and a word is a processor's natural data width (often 16, 32 or 64 bits). Within any binary word, the MSB is the leftmost bit carrying the largest weight (worth 128 in an 8-bit unsigned byte), while the LSB is the rightmost bit carrying weight 1 (determining whether an integer is odd or even).
Fractions that terminate neatly in decimal do not always terminate in binary. Doubling gives , producing the repeating binary fraction . Because computers store a finite number of bits, floating-point arithmetic holds an approximation very close to rather than the exact fraction—which is why may not equal exactly in code.
Only decimal fractions whose denominator is a power of 2 (such as , or ) terminate in binary.
When real-world signals enter a computer, sampling converts continuous waves into digital data by measuring the signal at regular intervals (for example, 44,100 times per second for audio) and quantising each sample into binary bits. By Nyquist's sampling theorem, you must sample at more than twice the highest frequency in the signal, or high frequencies fold down into distorted aliases.
Once inside digital circuits, noise margins keep bits reliable: for instance, 0–0.8 V may be read as 0 and 2–5 V as 1, leaving an unused middle band so small electrical interference cannot flip a logic level.
Worked example
Worked Example: 110101.101₂ to decimal and hexadecimal
- 1 Step 1
Expand the integer part by positional weights: .
Pause & think
Convert to binary and to decimal. Which conversion requires positional weights, and which relies purely on grouping?
Positional weights evaluate any base in decimal, repeated division and multiplication convert between bases, and 3-bit or 4-bit grouping bridges binary with octal and hexadecimal.
📌 If you remember nothing else…
- Digital signals use discrete voltage levels with noise margins, and each column in base has weight .
- Integer parts convert via repeated division by the target base, while fractional parts convert via repeated multiplication.
- Octal groups 3 bits per digit and hexadecimal groups 4 bits per digit outward from the binary point.
- For example, , and .
Quick check
Did it land?
Spotted a mistake?