To convert the 8-bit binary sequence 10110101 to decimal, the exact answer is 181. Conversely, converting the decimal value 181 to binary yields 10110101. These conversions assume a standard unsigned integer format. If you are working with microcontrollers like an ESP32 or reading raw I2C sensor registers, treating this same 8-bit sequence as a signed (two's complement) integer shifts the decimal answer to -75. Below, we break down the exact formulas, the assumptions that dictate your final number, and a quick-reference table for surrounding values.

The Core Conversion Formulas (With Substituted Values)

Whether you are debugging a serial monitor output or calculating a PWM duty cycle, you need to know the math behind the machine. Here is how the conversion works in both directions using our anchor value of 181.

Binary to Decimal (Positional Notation)

Every bit in a binary string represents a power of 2, starting from $2^0$ on the far right (the Least Significant Bit, or LSB).

Formula: D = (bn × 2n) + ... + (b1 × 21) + (b0 × 20)

Substituting 10110101:
(1 × 27) + (0 × 26) + (1 × 25) + (1 × 24) + (0 × 23) + (1 × 22) + (0 × 21) + (1 × 20)
= 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181

Decimal to Binary (Successive Division by 2)

To go backward, divide the decimal number by 2 repeatedly. The remainders form your binary string, read from bottom to top (MSB to LSB).

  • 181 ÷ 2 = 90, Remainder 1 (LSB)
  • 90 ÷ 2 = 45, Remainder 0
  • 45 ÷ 2 = 22, Remainder 1
  • 22 ÷ 2 = 11, Remainder 0
  • 11 ÷ 2 = 5, Remainder 1
  • 5 ÷ 2 = 2, Remainder 1
  • 2 ÷ 2 = 1, Remainder 0
  • 1 ÷ 2 = 0, Remainder 1 (MSB)

Reading the remainders from the last division up to the first gives 10110101.

The Assumptions That Fix Your Answer

In AC power calculations, the answer shifts based on voltage, power factor, and phase. In digital logic and embedded systems, the equivalent assumptions that fix your conversion are sign representation and bit-width. A single binary string does not have a universal decimal value until you define the data type.

Unsigned vs. Signed (Two's Complement)

If your C++ code defines a variable as uint8_t (unsigned 8-bit integer, common for PWM registers on an Arduino Uno), 10110101 is strictly 181. However, if the sensor datasheet specifies a signed 8-bit integer (int8_t), the Most Significant Bit (MSB) acts as a sign flag. Because the MSB here is 1, the number is negative. To find the decimal value, you apply the two's complement rule: invert the bits (01001010), add 1 (01001011, which is 75), and apply the negative sign to get -75. For a deep dive on this architecture, refer to the All About Circuits digital logic textbook.

How the Answer Shifts for 8-bit vs. 16-bit vs. 32-bit

Just as a 120V circuit behaves differently than a 230V or 3-phase circuit, bit-width changes the ceiling. In an 8-bit system, 10110101 is 181. If that same sequence is the lower byte of a 16-bit big-endian register (e.g., 00000000 10110101), it remains 181. But if it is the upper byte (10110101 00000000), the decimal value shifts massively to 46,336. Always check the endianness and register width in your microcontroller's technical reference manual.

When the Conversion is Meaningless: Applying pure base-2 polynomial math is useless if the binary string represents IEEE 754 floating-point data (like a 32-bit float from a Modbus sensor) or Binary Coded Decimal (BCD) from a DS1307 Real-Time Clock. In BCD, 10110101 isn't 181; it's an invalid state, as BCD only uses 0000 to 1001 to represent digits 0-9. Always verify the data encoding format before converting.

Neighboring Values Reference Table (±20% Range)

When bench-testing ADCs or DACs, you rarely hit the exact target number on the first try. Below is a reference table for values within a ±20% range of our 181 anchor, showing how the binary and hexadecimal representations shift. This is highly useful when verifying Texas Instruments data converter outputs on an oscilloscope.

Decimal 8-Bit Binary Hexadecimal Signed 8-Bit (Two's Comp)
145100100010x91-111
155100110110x9B-101
165101001010xA5-91
175101011110xAF-81
181101101010xB5-75
190101111100xBE-66
200110010000xC8-56
217110110010xD9-39

Frequently Asked Questions

How to convert binary to decimal with a decimal point (fractional binary)?

When dealing with fixed-point math in DSP (Digital Signal Processing) or high-resolution DACs, bits to the right of the binary point represent negative powers of 2. For example, to convert 101.11:
Left of point: (1 × 22) + (0 × 21) + (1 × 20) = 4 + 0 + 1 = 5.
Right of point: (1 × 2-1) + (1 × 2-2) = 0.5 + 0.25 = 0.75.
Combine them: 5 + 0.75 = 5.75.

What is the fastest way to convert decimal to binary in your head?

Skip the division and use the Subtract Largest Power of 2 method. Memorize your powers of 2 up to 128 (1, 2, 4, 8, 16, 32, 64, 128). To convert 181:
1. Largest power under 181 is 128. (181 - 128 = 53). Bit 7 = 1.
2. Largest power under 53 is 32. (53 - 32 = 21). Bit 5 = 1.
3. Largest power under 21 is 16. (21 - 16 = 5). Bit 4 = 1.
4. Largest power under 5 is 4. (5 - 4 = 1). Bit 2 = 1.
5. Largest power under 1 is 1. (1 - 1 = 0). Bit 0 = 1.
Fill the gaps with zeros: 10110101. This is much faster on the bench when you don't have a calculator handy.

How do you convert negative decimal numbers to binary?

Microcontrollers do not use a simple "minus sign" bit; they use Two's Complement. To convert -45 to an 8-bit binary string:
1. Convert positive 45 to binary: 00101101.
2. Invert all bits (One's Complement): 11010010.
3. Add 1 to the result: 11010011.
Therefore, -45 in 8-bit signed binary is 11010011 (or 0xD3 in hex). If you cast this directly to an unsigned integer in your code without handling the sign, your program will read it as 211, leading to massive calculation errors in control loops.