gettoolz.app

Binary to decimal converter

Convert binary numbers to decimal — by adding up each digit times its power of 2. Exact at any size, with a worked example and a table of common values. Free, and computed in your browser.

Part of developer tools.

Base

Binary

10101101

Octal

255

Decimal

173

Hexadecimal

AD

Binary to decimal table

BinaryDecimal
00
11
102
113
1004
1015
1106
1117
10008
10019
101010
101111
110012
110113
111014
111115
1000016
1100100100
1111111127
11111111255
100000000256
11111010001000
100000000001024
10000000000004096
111111111111111165535
111111111111111111111111111111114294967295
111111111111111111111111111111111111111111111111111111111111111118446744073709551615

The last rows are the largest 32-bit and 64-bit unsigned values. The second is past the point where ordinary JavaScript numbers start rounding; the table and the converter above both compute with BigInt, so every digit is exact.

How to convert binary to decimal

Each binary digit stands for a power of two — 1, 2, 4, 8, 16 and so on, counting from the right — so the decimal value is simply the sum of the powers where the bit is 1; the 0 bits contribute nothing. For 10101101: 2⁷ + 2⁵ + 2³ + 2² + 2⁰ = 128 + 32 + 8 + 4 + 1 = 173.

Binary and decimal side by side

The largest 16-bit value is 1111111111111111 in binary and 65535 in decimal: 16 digits against 5. A decimal digit is worth log₂ 10 ≈ 3.32 bits — not a whole ratio, so decimal and binary digits never line up and there is no digit-by-digit shortcut: the whole number has to be added up, as above. Binary is what bit masks, flags and subnet masks are reasoned in: a /24 network mask is twenty-four 1 bits followed by eight 0 bits, 255.255.255.0 once written in decimal. In JavaScript and Python source, 173 is written 0b10101101 in binary and 173 with no prefix in decimal. Paste a prefixed number into the converter and it switches to the matching base; a number with no prefix is read in the selected base — binary on this page.

Other conversions

Going the other way? Decimal to binary converter.

Or open the full number base converter and see a number in all four bases at once.