Binary Code to Decimal
Convert binary to an unsigned decimal integer, or swap to convert decimal back to binary. This is number conversion, not character decoding. BigInt preserves integer precision within the input and browser limits.
On this page
Add the positions that contain 1
Starting at the right, positions are worth 1, 2, 4, 8, and successive powers of two. For 101101, the positions worth 32, 8, 4, and 1 are set. Their sum is 45.
| Position from right | Bit | Place value | Contribution |
|---|---|---|---|
| 5 | 1 | 32 | 32 |
| 4 | 0 | 16 | 0 |
| 3 | 1 | 8 | 8 |
| 2 | 1 | 4 | 4 |
| 1 | 0 | 2 | 0 |
| 0 | 1 | 1 | 1 |
Convert decimal back to binary
Repeatedly divide by two and record the remainders. For 13: 13 ÷ 2 gives 6 remainder 1; 6 ÷ 2 gives 3 remainder 0; 3 ÷ 2 gives 1 remainder 1; 1 ÷ 2 gives 0 remainder 1. Read upward to get 1101.
Swap uses the valid result as the new input. Leading zeroes do not affect the unsigned value and are not restored: 00000101 becomes 5, then 101.
Check an exact 64-bit result
Sixty-four ones represent 2⁶⁴ − 1, or 18446744073709551615. Paste the example below to check the full value. JavaScript's ordinary Number type cannot represent every integer this large; this tool uses BigInt instead.
BigInt avoids floating-point rounding, but not memory limits. Input fields accept at most 20,000 UTF-16 code units, including separators.
| Binary | Decimal |
|---|---|
| 101 | 5 |
| 11111111 | 255 |
| 1111111111111111111111111111111111111111111111111111111111111111 | 18446744073709551615 |
Know what this number does not say
11111111 is 255 as an unsigned integer, but −1 under eight-bit two's complement. A signed reading requires an agreed format and bit width; this converter does not infer them.
Negative integers, fractions, decimal points, and scientific notation are outside its scope. If you expect a word, use a text decoder. The unsigned value of 01000001 is 65; only an ASCII or UTF-8 interpretation makes it A.
Frequently asked questions
What is 101 in decimal, and how is it calculated?
As an unsigned binary integer, 101 equals decimal 5: 1 × 4 + 0 × 2 + 1 × 1. Each position is a power of two, starting with 1 on the right. This is a numeric interpretation; the same three digits are not a complete ASCII or UTF-8 text group.
PermalinkHow do I convert decimal back to binary?
Use Swap to switch to decimal input, then enter an unsigned whole number. For example, decimal 13 becomes 1101. By hand, repeatedly divide by two and read the remainders from last to first. The converter returns an integer's bits, not the ASCII bytes of its printed decimal digits.
PermalinkAre leading zeroes or a fixed bit width preserved?
No. Leading zeroes do not change an unsigned integer's value, and decimal-to-binary output uses the shortest representation. Thus 00000101 becomes 5, and converting back produces 101. Zero is written as 0. Record the original width separately if a protocol or exercise requires an eight-, sixteen-, or other fixed-width field.
PermalinkCan this converter handle 64-bit numbers without rounding?
Yes. It uses BigInt for exact integer conversion: 64 binary ones equal 18446744073709551615. It does not pass that value through floating-point arithmetic. Exactness is still subject to practical input and browser-memory limits; the input field allows up to 20,000 UTF-16 code units, including separators, rather than unlimited data.
PermalinkCan I include spaces, commas, underscores, or a 0b prefix?
Spaces, commas, and underscores are removed in both number-conversion directions. For example, binary 1111_0000 becomes decimal 240, and decimal 1,000 becomes binary 1111101000. Separators do not create a list of separate values. A 0b prefix, signs, decimal points, and scientific notation are not accepted; enter the digits of one unsigned integer.
PermalinkDoes this support signed binary, two's complement, or fractions?
No. This converter reads unsigned whole numbers only. For example, 11111111 is 255 here, whereas an eight-bit two's-complement interpretation gives −1. Signed values require a specified representation and bit width; fractions require rules for the fractional positions. The tool does not infer either format from the digits.
PermalinkWhy does 01000001 produce 65 instead of A?
The number converter adds binary place values, so 01000001 becomes the unsigned integer 65. A text decoder then needs an encoding such as ASCII to map that value to A. If your source is a word or sentence, use the text decoder; converting the whole message as one number loses its character boundaries.
Permalink↑ Back to the converter · Page contents
Sources & verification
Reference material used for this explanation. The examples are reproducible with the tools on this site; see how they are checked.
Found a mismatch? Send a correction with a source.