Convert binary to decimal and back with the working shown: powers of two, division tables, binary fractions, repeating bits and two's complement.
Eight ones and zeros can mean two different numbers, and most converters only tell you one of them. Type 1011 0110 here and you get 182, the plain reading, and also −74, what the same byte means to a computer storing signed 8-bit integers. Both come with the sum that produced them.
It runs the other way too. Decimal → Binary turns 156 into 1001 1100 and shows the divide-by-2 table a textbook would, with the remainders read from the bottom up. Decimals work as well, and when one never ends in binary, as 0.1 doesn’t, the repeating block is found exactly and shown in brackets: 0.0(0011).
All the arithmetic is exact. Whole numbers of any size up to 1,024 bits or 300 decimal digits are handled as big integers, so 9007199254740993, one past the largest integer JavaScript stores exactly, converts without losing its final 1.
The page opens on 1011 0110 with the width set to 8-bit. The working lists the bits that are 1 as powers of two, 2⁷ + 2⁵ + 2⁴ + 2² + 2¹, then their values, 128 + 32 + 16 + 4 + 2, for a total of 182. Because the top bit is 1, the two’s-complement line reads the byte as 182 − 256 = −74.
Load Sample then steps through 156 to binary, the binary fraction 101.101 (5.625), 0.1 with its repeating block, and -42, which 8-bit two’s complement stores as 1101 0110.
101.101 is 4 + 1 + 0.5 + 0.125 = 5.625. A binary fraction always ends in decimal, so these answers are never rounded.0110 is a positive 4-bit 6, while 110 is a 3-bit −2.102 shows “Binary digits are only 0 and 1, so "2" (character 3) can’t be read. Spaces and underscores between groups are fine.”182
1011 0110 · 8 bits
As 8-bit two’s complement the top bit is the sign, so these bits mean -74.
Working
2⁷ + 2⁵ + 2⁴ + 2² + 2¹
= 128 + 32 + 16 + 4 + 2
= 182
Each 1 adds the power of two for its position, counting from 2⁰ at the right of the binary point; positions after the point are 2⁻¹ = 0.5, 2⁻² = 0.25 and so on.