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 `0b` prefix 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 Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.