Binary to decimal and decimal to binary converter
Binary to decimal: add up the powers of 2 where there is a 1, so 1011 (binary) = 11 (decimal) and 1010 1010 (binary) = 170 (decimal). Type a binary number (spaces and 0b are fine) and the decimal value appears as you type, with hex and octal underneath; decimal to binary works in the same box.
Source: Wikipedia: Positional notation (base conversion, place values). Updated: .
How it is calculated
How to convert binary to decimal
Each place is worth twice the one to its right: 1, 2, 4, 8, 16, 32, 64, 128 from the right. Add the places that hold a 1. 1011 is 8 + 2 + 1 = 11; the byte 1011 0110 is 128 + 32 + 16 + 4 + 2 = 182. The working under the answer lists the place values of your number.
The doubling method
For long numbers it is quicker to read left to right: start with 0, and for every bit double the running total and add the bit. For 1101: 0 → 1 → 3 → 6 → 13, so 1101 (binary) = 13 (decimal). It needs no table of powers, only the ability to double.
Decimal to binary
Divide by 2 repeatedly and read the remainders from the last to the first. For 13: 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, giving 1101: 13 (decimal) = 1101 (binary). The number of bits grows slowly: 255 needs 8 bits (255 (decimal) = 1111 1111 (binary)), 256 needs 9 bits, 1,024 needs 11.
Bytes, IP addresses and masks
- One byte: 0000 0000 to 1111 1111 covers 0 to 255, which is 256 values.
- IPv4: each of the four numbers is a byte. 192.168.1.1 is 11000000.10101000.00000001.00000001: 1100 0000 = 192, 1010 1000 = 168.
- Subnet masks: 1111 1000 = 248, which is why a /21 network has the mask 255.255.248.0.
- Text: ASCII “A” is 0100 0001 = 65.
Counting on your fingers
Ten fingers, each up (1) or down (0), represent the numbers 0 to 1,023, because ten bits give 2¹⁰ = 1,024 values; with all fingers up the number is 1023. A byte read as a signed number (two’s complement) gives 1000 0000 = −128 rather than 128, a case handled by the number base converter. For hex see hex to decimal and for binary arithmetic the binary calculator.
Frequently asked questions
How do I convert binary to decimal?
Write the place values 1, 2, 4, 8 ... under the bits from the right and add those with a 1. For 1011: 8 + 2 + 1, so 1011 (binary) = 11 (decimal).
What is 1111 1111 in decimal?
1111 1111 (binary) = 255 (decimal). That is 2⁸ − 1, the largest value of one byte.
How do I convert decimal to binary?
Divide by 2 repeatedly and read the remainders from last to first. For 13: 13 (decimal) = 1101 (binary).
What is 10000000 in decimal?
1000 0000 (binary) = 128 (decimal), i.e. 2⁷. As a signed 8-bit number the same pattern means −128.
How many bits does a number need?
The largest n-bit number is 2ⁿ − 1, so 255 needs 8 bits (255 (decimal) = 1111 1111 (binary)) and 256 needs 9 (256 (decimal) = 1 0000 0000 (binary)).
Sources and legal basis
- Wikipedia: Positional notation (base conversion, place values)
- Unicode Standard – code points are written in hexadecimal (U+0041 = 65)
As of: · Editorial policy
Related tools
- Number base converter with stepsConvert between binary, octal, decimal, hex and any base from 2 to 36 – with full working, fractions, repeating digits and two’s complement (8–64 bit).
- Binary Calculator with StepsBinary calculator online: add, subtract, multiply, divide and combine binary numbers with AND, OR, XOR – result also in decimal, hex and two’s complement.
- Hex to decimal and decimal to hex converterHex to decimal: multiply each digit by a power of 16, so FF = 255. Type hex for decimal, binary and octal, or go back from decimal, with the working.
- IPv4 Subnet Calculator: Network, Broadcast, Host Range and SubnettingIPv4 subnet calculator with CIDR: network address, broadcast, usable host range, subnet mask, wildcard and host count – binary working and subnetting.
- Text to binary converter (and binary to text)Convert text to binary, hex, decimal or octal and translate binary back to text – with UTF-8 for accents and emoji, right in your browser, nothing uploaded.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- CGPA calculator for Nigerian universities (5-point scale)CGPA calculator Nigeria: enter each course with its grade or score and credit units to get your GPA or CGPA on the 5.0 scale, the class of degree and the steps.
- WAEC grade calculator (WASSCE, A1 to F9)WAEC grade calculator: type each subject with its score to see the grade from A1 to F9, the remark and your number of credits, with English and Maths checked.
- School Year Calculator (England, Scotland, Northern Ireland)School year calculator for the UK: enter a date of birth and see the year group and key stage for any school year – England, Scotland and Northern Ireland.