Six bits: 101010
101010
42
32 + 8 + 2 = 42. The 0s add nothing; they only hold their places.
Type a binary number and read its decimal value, with the working shown underneath. It opens on 101010, which is 42.
Last updated
Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.
Binary is base 2, so it has two digits, 0 and 1, and each position is worth twice the one to its right: 1, 2, 4, 8, 16, 32, 64, 128 and so on. A binary number is a list of which of those place values are switched on.
That turns the conversion into an addition. Write the place values under the bits, keep the ones that sit under a 1 and add them. 1101 has 1s under 8, 4 and 1, so it is 13. The panel under the converter does this for whatever you type.
Spaces and a 0b prefix are ignored, and the arithmetic uses BigInt, so a 64-bit number converts without rounding.
101010
42
32 + 8 + 2 = 42. The 0s add nothing; they only hold their places.
11111111
255
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, the largest value one byte holds.
111101101
493
256 + 128 + 64 + 32 + 8 + 4 + 1 = 493, which is 755 in octal: the chmod 755 permission.
10000000000
1024
A single 1 followed by ten 0s is 2¹⁰, which is 1024.
00001010 and 1010 are both 10, but a byte field needs all eight bits.int('101010', 2), which returns 42. In JavaScript, parseInt('101010', 2) does the same.