Binary to Decimal Converter
Convert binary (base 2) numbers to decimal (base 10).
Decimal
Binary to decimal, explained
Each binary digit represents a power of two, doubling from right to left (1, 2, 4, 8, 16…). To convert, sum the place values wherever a 1 appears — so 101010 = 32 + 8 + 2 = 42. This converter accepts arbitrarily long bit strings and runs entirely in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Reading the value of a bitfield or a flags register as an ordinary number.
- Checking the result of a bit-shift or a mask operation against what you expected.
- Turning a binary value from a datasheet into a number you can use in code.
- Confirming a power-of-two boundary from its bit pattern.
- Reading a binary value out of a protocol trace.
Frequently Asked Questions
- How does the conversion work?
- Each position is a power of two, read right to left from 2^0. 1011 is 8 + 0 + 2 + 1 = 11. Doubling and adding each next digit (Horner's method) is the way it is done in code — it avoids computing powers at all.
- How do negative numbers work?
- Through two's complement, where the leading bit carries a NEGATIVE weight. In 8 bits, 11111111 is −1 and 10000000 is −128. This is why the negative range extends one further than the positive: −128 to 127.
- How many bits do I need for a number?
- floor(log2(n)) + 1. A value up to 255 needs 8 bits, up to 65535 needs 16. Exceeding the width wraps rather than erroring in most languages, which is the mechanism behind integer overflow bugs.
- Why do computers use binary at all?
- Because a transistor reliably distinguishes two voltage states but not ten. Ternary computers were built (the Soviet Setun) and worked, but two-state logic is far more robust to noise, which decided the matter.
- What is the difference between MSB and LSB ordering?
- Which end is most significant. Within a written number the leftmost bit is most significant, but across MULTI-BYTE values the byte order is endianness: little-endian stores the low byte first (x86), big-endian the high byte (network order).
- How do I read a binary value quickly?
- By recognising the powers of two per position and adding the set bits, or by grouping in fours and converting each to hex first. The second is faster past about eight bits, which is why hex exists at all.
- What is the largest value for a given bit width?
- Two to the power of the width, minus one — 255 for eight bits, 65,535 for sixteen. That off-by-one is why an unsigned overflow wraps to zero rather than to one.
Common errors and gotchas
- Ignoring the width, which decides whether the top bit is a value or a sign.
- Reading the bits in the wrong order, where the least significant may be written first in some documentation.
- Including a
0bprefix or spaces in the digits and getting a parse error rather than a value. - Assuming leading zeros are meaningless, when they carry the field width.
- Treating a grouped display as separate values rather than one number.
Related tools
Base Converter
Convert numbers between binary, octal, decimal, hex, and base 2-36.
Hex to Decimal Converter
Convert hexadecimal (base 16) numbers to decimal (base 10).
Gray Code Converter
Convert between binary and Gray code (reflected binary code), and convert decimal to Gray code and back.
Hex Dump Viewer
View binary files as a hex dump in xxd format — offset, hex bytes, and ASCII side-by-side. Upload a file or paste hex data.
IP to Binary Converter
Convert IPv4 addresses to binary and hex notation, and decode subnet masks.
Decimal to Hex Converter
Convert decimal (base 10) numbers to hexadecimal (base 16).
Decimal to Octal Converter
Convert decimal (base 10) numbers to octal (base 8).
Roman Numeral Converter
Convert numbers to Roman numerals and back.