Binary to Decimal Converter: Exact, Any Length
Convert binary to decimal exactly, for numbers of any length, in your browser. Also shows octal, hex, BCD, Gray code and two's complement. Nothing is uploaded.
About the Binary to Decimal Converter
This page opens the Number Base Converter with binary as the input and decimal highlighted at the top of the results. Paste a string of 0s and 1s and you get its exact decimal value, however long it is, along with octal, hexadecimal, BCD, Gray code and two's complement. Each result has a Copy button. The conversion runs in your browser, and nothing is uploaded.
How to use it
Steps
- Type or paste the binary number. A
0bprefix is accepted, and spaces or underscores between groups of bits are ignored, so1111 1111,0b1111_1111and11111111are the same value. - Read the decimal value at the top. A leading minus sign is kept, so
-1010gives −10. - If the bits are a signed machine integer, read the Two's complement row instead and choose the width of 8, 16, 32 or 64 bits. Or switch From to two's complement to decode the pattern as a signed number.
How binary becomes decimal
Place values
Each binary digit is worth twice the digit to its right. Reading from the right, the places are worth 1, 2, 4, 8, 16, 32, 64, 128 and so on. To convert, add the place values where the bit is 1. For 101101, that is 32 + 8 + 4 + 1 = 45.
Doubling from the left
A quicker method by hand is to start with 0 and, for each bit from the left, double the running total and add the bit. For 101101: 1, 2, 5, 11, 22, 45. The converter does the same with arbitrary-precision integers, so a 128-bit or 1,000-bit value is exact rather than rounded the way a calculator's floating-point number would be.
Signed or unsigned
The same bits can mean different numbers. As an unsigned value, 11111111 is 255. Read as an 8-bit two's complement integer, the way most processors store signed bytes, it is −1. The converter shows both, so you can pick the one that matches the program or datasheet you are reading.
Common values
1010is 10,1111is 15 and10000is 16.11111111is 255, the largest unsigned byte.1111111111111111is 65,535, the largest unsigned 16-bit value.- A 1 followed by 32 zeros is 4,294,967,296, which is 2 to the power of 32.
Privacy
The conversion is done by code on this page. Your numbers never leave your device and nothing is kept after you close the tab.
Related tools
To go the other way, use Decimal to Binary. For hexadecimal, see Hex to Decimal. To do arithmetic or bitwise operations on binary numbers, use the Binary Calculator. If your binary is text encoded as bytes, such as 01001000 01101001, use Binary to Text instead.
Open-source credits
- The converter is written for this site and uses no third-party library. Arithmetic uses the browser's built-in
BigInt, specified in ECMA-262, the ECMAScript language specification. - Two's complement follows the signed integer representation required by ISO/IEC 9899:2024 (C23).