Binary to denary conversion is the mathematical process of translating a base-2 sequence of 0s and 1s into a standard base-10 number by multiplying each bit by ascending powers of two and summing the results. In a real circuit or installation, mastering this translation changes how you interpret raw logic states—like reading an 8-position DIP switch configuration or decoding a microcontroller's configuration register—into human-readable values like DMX addresses, baud rate divisors, or sensor thresholds. Beginners commonly confuse raw binary with hexadecimal (base-16), which is merely a shorthand used in datasheets, or they trip over bit-ordering (Endianness) when reading shift registers and serial data streams.
The Core Math: How to Work Out Binary to Denary
To convert any binary number to denary (also known as decimal), you need to understand positional weight. In our everyday base-10 system, the number 345 means (3 × 100) + (4 × 10) + (5 × 1). In base-2, the columns don't multiply by 10; they multiply by 2. Each position represents a power of 2, starting from 2⁰ (which is 1) on the far right.
| Bit Position | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
| Denary Weight | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Let us look at a concrete worked example. Suppose you are reading an 8-bit status register from a sensor and your logic analyzer outputs the binary sequence 10110101. Here is how to work out the denary value:
Worked Example: Converting 10110101 to Denary
- Bit 7 is 1: 1 × 128 = 128
- Bit 6 is 0: 0 × 64 = 0
- Bit 5 is 1: 1 × 32 = 32
- Bit 4 is 1: 1 × 16 = 16
- Bit 3 is 0: 0 × 8 = 0
- Bit 2 is 1: 1 × 4 = 4
- Bit 1 is 0: 0 × 2 = 0
- Bit 0 is 1: 1 × 1 = 1
Sum: 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181
For a deeper dive into the foundational mathematics of base systems, All About Circuits' Digital Textbook provides excellent visual breakdowns of positional weighting and base arithmetic.
Where You Meet This in Practice
You might think binary conversion is purely academic, but on the workbench, it is a daily requirement for configuring hardware and debugging communication protocols.
Scenario 1: Setting DMX512 Lighting Addresses
In theatrical and architectural lighting, DMX512 fixtures are often configured using a 9-position or 10-position DIP switch on the back panel. The switches represent binary weights from 1 to 256. If your lighting console is patched to send data to fixture address 137, you need to work out binary to denary in reverse to set the physical switches.
Starting from the highest weight (256) and working down:
- Is 137 ≥ 256? No. (Switch 9 = OFF)
- Is 137 ≥ 128? Yes. (Switch 8 = ON). Remainder: 137 - 128 = 9.
- Is 9 ≥ 64? No. (Switch 7 = OFF)
- Is 9 ≥ 32? No. (Switch 6 = OFF)
- Is 9 ≥ 16? No. (Switch 5 = OFF)
- Is 9 ≥ 8? Yes. (Switch 4 = ON). Remainder: 9 - 8 = 1.
- Is 1 ≥ 4? No. (Switch 3 = OFF)
- Is 1 ≥ 2? No. (Switch 2 = OFF)
- Is 1 ≥ 1? Yes. (Switch 1 = ON). Remainder: 0.
You flip switches 8, 4, and 1 to the ON position. The fixture now listens to DMX address 137.
Scenario 2: Debugging I2C Sensor Registers
When wiring an MPU-6050 accelerometer to an ESP32 or Arduino, the first step in your code is usually to read the WHO_AM_I register to verify communication. The datasheet states this register returns 0x68. If your serial monitor prints the denary number 104, you need to know that these are the exact same value. Hexadecimal 0x68 translates to binary 01101000, which converts to denary as 64 + 32 + 8 = 104. Recognizing this equivalence saves you from hours of chasing phantom wiring faults.
Common Pitfalls: Endianness and Hexadecimal Shorthand
The most frequent mistake makers make when converting binary to denary is ignoring Endianness—the order in which bits are transmitted or physically wired.
Take the ubiquitous 74HC595 shift register. It has 8 output pins labeled Q0 through Q7. If you shift in the binary byte 10000000 (which is 128 in denary if we assume the left-most bit is the Most Significant Bit, or MSB), the physical pin that goes HIGH depends on how the data was clocked in. If your microcontroller shifts the MSB first, Q7 will go HIGH. If it shifts the Least Significant Bit (LSB) first, Q0 will go HIGH. Always check the datasheet's timing diagram to confirm whether the device expects MSB-first or LSB-first data, as this completely flips your denary interpretation of the physical outputs.
Another common confusion is treating hexadecimal as a completely different math system rather than what it actually is: a visual compression of binary. Because 16 is a power of 2 (2⁴), every single hex digit maps perfectly to a 4-bit binary 'nibble'. SparkFun's Binary Tutorial highlights that learning to translate hex to binary in your head (e.g., knowing that 'F' is always '1111' and 'A' is always '1010') is vastly more useful on the bench than memorizing hex-to-denary tables.
Frequently Asked Questions
How to work out binary to denary with fractional numbers?
Fractional binary works exactly like fractional denary, but instead of moving to the right of a decimal point with tenths and hundredths, you use negative powers of 2. The first position to the right of the binary point is 2⁻¹ (0.5), the second is 2⁻² (0.25), and the third is 2⁻³ (0.125). For example, the binary number 10.11 translates to (1 × 2) + (0 × 1) + (1 × 0.5) + (1 × 0.25), which equals a denary value of 2.75. This is heavily used in fixed-point math on microcontrollers that lack a hardware floating-point unit.
What is the fastest way to convert binary to denary in your head?
The fastest mental method is the 'Doubling Method' (also known as Horner's method). Start with a total of zero. Read the binary number from left to right. For every bit, multiply your current total by 2, then add the value of the current bit. For 1011: Start with 1. Next bit is 0: (1×2)+0 = 2. Next bit is 1: (2×2)+1 = 5. Next bit is 1: (5×2)+1 = 11. This avoids having to mentally calculate large powers of 2 like 128 or 256 and is much faster for 16-bit or 32-bit sequences.
How do I convert a 16-bit binary number to denary?
The mathematical process is identical to 8-bit conversion, but you must extend your positional weight table to 16 columns. The weights for the upper byte (Bits 8 through 15) are 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. If you are doing this on the bench, it is highly recommended to use the Windows Calculator in 'Programmer' mode or a smartphone engineering app, as mental math on 16-bit values (which can reach up to 65,535) is highly prone to transcription errors.
Why do datasheets use hexadecimal instead of binary or denary?
Datasheets use hexadecimal because it maps perfectly to the physical architecture of digital memory and registers. A standard 8-bit register is easily split into two 4-bit nibbles. Writing 11110000 in binary is tedious to read and easy to miscount. Writing 240 in denary completely obscures the underlying bit pattern (you cannot instantly tell which bits are high). Writing 0xF0 in hex instantly tells an engineer that the top four bits are HIGH and the bottom four bits are LOW, making it the ideal middle ground between human readability and machine architecture.






