Binary Calculator
Convert binary, decimal, hex & octal - and do binary math
๐ Base converter
Type a value in any field. The other three update instantly.
๐ฏ Decimal value
๐ How binary 1010 = 10
| Bit | Place (2โฟ) | Value | Contribution |
|---|---|---|---|
| 1 | 2^3 = 8 | 1 | 8 |
| 0 | 2^2 = 4 | 0 | 0 |
| 1 | 2^1 = 2 | 1 | 2 |
| 0 | 2^0 = 1 | 0 | 0 |
| Total | 10 | ||
Works with unsigned (non-negative) whole numbers. Division is integer division with a separate remainder. Calculations use JavaScript number precision (safe up to 9,007,199,254,740,991).
Last updated June 2026
Method: Conversions use exact positional notation (each digit times its base raised to its place). Arithmetic is performed on the integer values and the results are rendered back into every base. These are exact mathematical definitions, not approximations.
Included: Bidirectional conversion between binary, octal, decimal and hexadecimal; addition, subtraction, multiplication and integer division of two binary numbers; a place-value breakdown and the result shown in all four bases.
Not included: Negative numbers, two's-complement representation, signed integers, binary fractions, and values beyond JavaScript's safe-integer limit (2^53 - 1).
Binary calculator: convert and compute with base-2 numbers
Computers do not count in tens the way people do. They count in binary - a number system with only two digits, 0 and 1 - because every electronic switch inside a chip is simply off or on. This binary calculator does two jobs at once: it converts a value between binary, decimal, hexadecimal and octal, and it performs binary arithmetic (addition, subtraction, multiplication and division) on two binary numbers. Type 1010 into the binary field and you instantly see it is 10 in decimal, 12 in octal, and A in hexadecimal - along with a place-value table that shows exactly why.
What "binary" actually means
A number system's base (or radix) is how many distinct digits it uses. Decimal is base 10 because it uses ten digits, 0 through 9. Binary is base 2: the only legal digits are 0 and 1, called bits (short for "binary digits"). Just as each position in a decimal number is worth ten times the one to its right, each position in a binary number is worth twice the one to its right. So the binary places, reading from the right, are 1, 2, 4, 8, 16, 32, and so on - the powers of two.
The conversion formula
To read any number in any base, multiply each digit by its place value and add. Formally, a number with digits d in base b has the value:
value = dₙ × bⁿ + … + d₂ × b² + d₁ × b¹ + d₀ × b⁰ For binary, b = 2. So the binary number 1011 equals (1×2³) + (0×2²) + (1×2¹) + (1×2⁰) = 8 + 0 + 2 + 1 = 11. The calculator above prints exactly this breakdown, bit by bit, so the answer is never a black box.
Worked example: binary to decimal
Take the byte 11001010. Line up the place values 128, 64, 32, 16, 8, 4, 2, 1 under the bits. Wherever there is a 1, add that place value: 128 + 64 + 8 + 2 = 202. Wherever there is a 0, add nothing. That is the entire trick to reading binary - it is just addition of selected powers of two.
Worked example: decimal to binary
Going the other way, use repeated division by 2 and collect the remainders. Convert 156: 156 / 2 = 78 r 0, 78 / 2 = 39 r 0, 39 / 2 = 19 r 1, 19 / 2 = 9 r 1, 9 / 2 = 4 r 1, 4 / 2 = 2 r 0, 2 / 2 = 1 r 0, 1 / 2 = 0 r 1. Read the remainders from bottom to top: 10011100. Typing 156 in the decimal field returns the same result without the longhand.
Worked example: binary addition
Binary addition uses the same columns as decimal, but you carry as soon as a column reaches 2 instead of 10. The four rules are 0+0=0, 0+1=1, 1+0=1, and 1+1=0 with a carry of 1. Add 1010 (10) and 110 (6): the rightmost columns produce carries that ripple left, and the answer is 10000 - which is 16, exactly 10 + 6. The Binary math tab shows both the binary and decimal forms so you can check yourself.
How to use this calculator
- Pick a mode at the top: "Convert" to translate one number across bases, or "Binary math" to add, subtract, multiply or divide.
- To convert, type into any of the four fields - binary, octal, decimal or hexadecimal. The other three update the instant you type, so you can start from whichever base you know.
- Read the result. The big number shows the decimal value, the cards show all four bases, and the table breaks the binary number into its place values.
- To do math, switch to Binary math, enter two binary numbers (only 0s and 1s), tap an operator, and read the result in binary plus its decimal and hex equivalents.
- Watch for errors. If you type a digit that is illegal for the chosen base - say an
8in a binary field - the calculator flags it instead of guessing.
Who this tool is for
- Students learning number systems in a computer-science, electronics or math class who need to check homework and see the steps.
- Programmers reading hex color codes, bitmasks, memory addresses, or file permissions and wanting a fast cross-base translation.
- Hardware and networking folks working with registers, subnet masks, and IP addresses, where binary and hex are everywhere.
- Anyone curious who has wondered what "01000001 is the letter A" really means and wants to play with the math directly.
Key terms explained
- Bit: a single binary digit, either 0 or 1. The smallest unit of data.
- Byte: a group of 8 bits. A byte holds 2⁸ = 256 patterns, the values 0 to 255.
- Nibble: 4 bits, exactly one hexadecimal digit. Two nibbles make a byte.
- Base / radix: the number of digits a system uses - 2 for binary, 8 for octal, 10 for decimal, 16 for hex.
- Most/least significant bit (MSB/LSB): the leftmost bit carries the largest place value; the rightmost carries the smallest (the ones place).
- Place value: the worth of a digit based on its position - a power of the base.
Quick reference: common conversions
The table below lists frequently used values across all four bases. Each binary entry is padded to a tidy width so the bit patterns line up.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 4 | 0100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
Why hex and octal are binary shorthand
Long bit strings are hard to read, so programmers compress them. Because 16 = 2⁴, every hexadecimal digit maps to exactly four bits: 1111 is F, 1010 is A, and so on. The byte 11001010 splits into 1100 and 1010, which is CA in hex. Similarly, because 8 = 2³, each octal digit stands for three bits. That tight mapping is why color codes (#FF8800), memory addresses, and Unix file permissions (chmod 755) are written in hex or octal rather than raw binary.
Binary subtraction, multiplication and division
Subtraction works column by column with borrowing, mirroring decimal: 1010 - 110 = 100 (10 - 6 = 4). This calculator uses unsigned numbers, so the first value must be the larger one. Multiplication is a series of shifts and adds - multiplying by a power of two just appends zeros, so 101 × 10 = 1010 (5 × 2 = 10). Division is integer division: 1011 / 10 = 101 remainder 1 (11 / 2 = 5 r 1). The tool always shows the remainder separately so nothing is silently dropped.
Tips for working in binary
- Memorize the powers of two (1, 2, 4, 8, 16, 32, 64, 128, 256...). Almost all binary mental math leans on them.
- Group bits in fours from the right when reading long numbers - it lines them up with hex and is far easier to scan.
- A leading zero never changes the value: 0101 and 101 are both 5. Padding is just for alignment.
- Doubling = a left shift. Appending a 0 on the right multiplies by 2, just as adding a 0 to a decimal number multiplies by 10.
Common pitfalls
The mistakes below trip up almost everyone learning binary; the calculator is built to catch them.
- Using illegal digits - a 2 in binary or an 8 in octal is invalid. The tool flags these instead of producing a wrong answer.
- Reading bits in the wrong direction - the rightmost bit is the ones place, not the leftmost.
- Forgetting the carry in addition when a column hits 1+1.
- Mixing up octal and hex - both compress binary, but in groups of three versus four bits.
Related concepts and calculators
Binary is one corner of a larger toolkit for working with numbers. To raise a number to a power - which is exactly what computing place values does - use the Exponent Calculator. The Scientific Calculator handles logarithms (log base 2 tells you how many bits a value needs) and more advanced functions. For everyday arithmetic and number crunching, the Percentage, Fraction, and Average calculators round out the set, and the Square Root Calculator covers roots. Together they cover most of the math you meet beyond a simple four-function calculator.
โ ๏ธ Common mistakes & edge cases
Typing a digit that the base does not allow
Binary only has 0 and 1; octal stops at 7; hex runs 0-9 then A-F. A "2" in a binary field or a "G" in a hex field is meaningless. The calculator rejects illegal digits and tells you which base they break, rather than quietly returning the wrong number.
Reading the bits backwards
The least significant bit is on the right (the ones place), and value grows to the left. Reading 110 as 6, not 3, depends on getting this direction right. The place-value table makes the order explicit.
Expecting negatives or fractions
This tool uses unsigned whole numbers. It will not subtract a larger number from a smaller one, and it ignores any binary point. For two's-complement or fixed-point work you need a dedicated representation; here, keep the first operand the larger one for subtraction.
Confusing integer division with exact division
Binary division here returns a whole-number quotient plus a remainder, like long division. So 1011 / 10 is 101 remainder 1, not 101.1. Read both the quotient and the remainder to get the full picture.
❓ Frequently asked questions
How do you convert binary to decimal?
Multiply each binary digit by its place value, which is a power of 2, and add the results. Reading right to left, the places are 1, 2, 4, 8, 16, and so on. For example, 1011 = (1x8) + (0x4) + (1x2) + (1x1) = 8 + 0 + 2 + 1 = 11. The converter above shows this place-value breakdown for any number you type.
How do you convert decimal to binary?
Repeatedly divide the decimal number by 2 and record each remainder. The remainders, read from the last one to the first, are the binary digits. For example, 13 divided by 2 is 6 remainder 1, 6 divided by 2 is 3 remainder 0, 3 divided by 2 is 1 remainder 1, and 1 divided by 2 is 0 remainder 1, giving 1101. Just type 13 in the decimal field and the binary appears instantly.
What is binary used for?
Binary (base 2) is how computers store and process all data, because a circuit is naturally either off (0) or on (1). Numbers, text, images, and instructions are ultimately sequences of bits. Programmers also use hexadecimal (base 16) and octal (base 8) as shorthand for binary because each hex digit maps to exactly four bits and each octal digit to three.
How does binary addition work?
Binary addition follows the same column method as decimal, but it carries whenever a column reaches 2. The rules are 0+0=0, 0+1=1, 1+0=1, and 1+1=10 (write 0, carry 1). For example, 1010 + 110 = 10000 in binary, which is 10 + 6 = 16 in decimal. The Binary math tab does this for you and also shows the decimal equivalent.
Can this calculator subtract, multiply and divide binary numbers?
Yes. Switch to the Binary math tab, enter two binary numbers, and choose +, -, x or /. Subtraction requires the first number to be greater than or equal to the second because the tool uses unsigned (non-negative) numbers. Division is integer division: it returns a whole-number quotient plus a separate remainder, both shown in binary and decimal.
What is the difference between binary, octal, decimal and hexadecimal?
They are number systems with different bases: binary is base 2 (digits 0-1), octal is base 8 (digits 0-7), decimal is base 10 (digits 0-9), and hexadecimal is base 16 (digits 0-9 then A-F). The same quantity looks different in each base. For example, decimal 255 is 11111111 in binary, 377 in octal, and FF in hexadecimal.
Why does hexadecimal use the letters A to F?
Hexadecimal has sixteen digits, but we only have ten numeral symbols (0-9). The letters A, B, C, D, E, and F stand in for the values 10, 11, 12, 13, 14, and 15. So hex FF means 15x16 + 15 = 255. Hex is popular with programmers because one hex digit represents exactly four binary digits, making long bit patterns easy to read.
How many values can a byte represent?
A byte is 8 bits. Each bit can be 0 or 1, so a byte has 2^8 = 256 possible patterns, representing the values 0 through 255. That is why color channels, for instance, often run from 0 to 255. More generally, n bits can represent 2^n different values.
Does this binary calculator handle negative numbers or fractions?
No. It works with unsigned, non-negative whole numbers only, which keeps the conversions and place-value breakdown clear. It does not model two's-complement negatives, signed integers, or binary fractions (bits after a binary point). For everyday conversion and integer arithmetic, that covers the common cases.
What is the largest number this calculator can handle?
Calculations use standard JavaScript numbers, which are exact for integers up to 9,007,199,254,740,991 (that is 2^53 - 1). Below that limit, every conversion and arithmetic result is exact. Above it, results may lose precision, so the tool is best for typical values rather than extremely large bit strings.
๐ก Good to know
Every hex digit is exactly four bits
Because 16 = 2⁴, you can convert between binary and hexadecimal by splitting the bits into groups of four from the right. That is why programmers lean on hex - it is binary, just four times shorter and far easier to read.
Leading zeros are free
0000 1010 and 1010 are the same number (10). Padding to 4 or 8 bits only helps readability and alignment with bytes - it never changes the value.
n bits hold 2 to the n values
One bit gives 2 options, a nibble (4 bits) gives 16, and a byte (8 bits) gives 256 (0-255). Doubling the bit count squares the range, which is why even small bit-widths cover huge numbers.
Related Calculators
Percentage Calculator
Solve any percentage problem - what is X% of Y and more
Fraction Calculator
Add, subtract, multiply and divide fractions
Scientific Calculator
A full scientific calculator with trig, logs and more
Average Calculator
Calculate the mean, median and mode of numbers
Square Root Calculator
Find the square root of any number
Exponent Calculator
Raise numbers to any power