Skip to content

Binary Calculator

Creator

Muhammad Azeem, AI Consultant

Reviewer

Muhammad Javaid Iqbal, Lead AI Engineer
Updated

This binary converter switches a number between binary and decimal in either direction, or works directly with binary arithmetic: add, subtract, multiply and divide two binary numbers and see the decimal equivalents alongside every result. It doubles as a decimal to binary calculator on one tab and a binary-to-decimal calculator on the other, since the same Convert tab handles both directions.

Nothing is uploaded anywhere: every number stays in your browser, and the decimal value behind each binary number is always shown next to it.

How binary place value works

Decimal (base 10) gives each digit position a place value that is a power of 10: ones, tens, hundreds, and so on. Binary (base 2) works the same way, except each position is a power of 2: ones, twos, fours, eights, sixteens, and so on, doubling every step to the left. A binary number is really just a shorthand for "add up the place values under every 1 digit."

Worked example. Take the binary number 1010. Reading right to left, the digits sit under the place values 1, 2, 4, 8:

  • Rightmost digit: 0, place value 1 → contributes 0
  • Next digit: 1, place value 2 → contributes 2
  • Next digit: 0, place value 4 → contributes 0
  • Leftmost digit: 1, place value 8 → contributes 8

Adding the contributions gives 8 + 0 + 2 + 0 = 10, so binary 1010 is decimal 10. Converting the other direction, from decimal to binary, repeatedly divides by 2 and records the remainders: 10 ÷ 2 = 5 remainder 0, 5 ÷ 2 = 2 remainder 1, 2 ÷ 2 = 1 remainder 0, 1 ÷ 2 = 0 remainder 1. Reading the remainders from last to first gives 1010, matching the answer above. The identical method converts any other value, 5 binary, 9 binary, 10 binary, 11 in binary, 12 in binary, 13 in binary, 14 in binary, 15 in binary, 17 in binary, and 25 in binary all follow from the same running total of place values, no matter how large the number gets.

Leading zeros never change the value. 0011, 011 and 11 are all decimal 3, which is why the calculator drops them from results and why a fixed-width form such as 00000011 is only padding to fill a byte.

Binary to decimal chart: 0 to 128

A quick binary chart, or binary table, is often faster than converting by hand for small, common numbers, and it doubles as a simple way to count in binary: reading down the Binary column shows exactly how the digits roll over at every power of two. The table below is generated from the same decimalToBinary conversion the calculator above uses, so every row matches exactly what typing that number into the Convert tab would show.

Binary to decimal chart from 0 to 128 (part 1 of 3)
DecimalBinary
00
11
210
311
4100
5101
6110
7111
81000
91001
101010
111011
121100
131101
141110
151111
1610000
1710001
1810010
1910011
2010100
2110101
2210110
2310111
2411000
2511001
2611010
2711011
2811100
2911101
3011110
3111111
32100000
33100001
34100010
35100011
36100100
37100101
38100110
39100111
40101000
41101001
42101010
Binary to decimal chart from 0 to 128 (part 2 of 3)
DecimalBinary
43101011
44101100
45101101
46101110
47101111
48110000
49110001
50110010
51110011
52110100
53110101
54110110
55110111
56111000
57111001
58111010
59111011
60111100
61111101
62111110
63111111
641000000
651000001
661000010
671000011
681000100
691000101
701000110
711000111
721001000
731001001
741001010
751001011
761001100
771001101
781001110
791001111
801010000
811010001
821010010
831010011
841010100
851010101
Binary to decimal chart from 0 to 128 (part 3 of 3)
DecimalBinary
861010110
871010111
881011000
891011001
901011010
911011011
921011100
931011101
941011110
951011111
961100000
971100001
981100010
991100011
1001100100
1011100101
1021100110
1031100111
1041101000
1051101001
1061101010
1071101011
1081101100
1091101101
1101101110
1111101111
1121110000
1131110001
1141110010
1151110011
1161110100
1171110101
1181110110
1191110111
1201111000
1211111001
1221111010
1231111011
1241111100
1251111101
1261111110
1271111111
12810000000

A few worth calling out: 7 in binary is 111, the largest 3-digit binary number there is. 8 in binary rolls over to 1000, the same way decimal rolls from 9 to 10. 10 in binary is 1010, not the coincidentally similar-looking 10 it might be mistaken for, and 128 in binary is a clean 10000000, a single 1 followed by seven zeros, since 128 is exactly 27. Every power of two follows that same one-followed-by-zeros pattern in binary, the exact reason binary counting leans so heavily on powers of two.

How many values fit in a given number of bits

Each extra bit doubles the number of values a binary number can hold, so n bits can represent 2n different values, from 0 up to 2n − 1. The table lists the sizes that come up most often, including the 53-bit ceiling this calculator inherits from JavaScript's number type.

largest value = 2^n - 1
Number of values and largest number for common bit sizes
BitsCommon nameValues (2^n)Largest number
1Bit21
4Nibble1615
8Byte256255
1616-bit integer65,53665,535
3232-bit integer, IPv4 address4,294,967,2964,294,967,295
53Largest exact integer in this calculator9,007,199,254,740,9929,007,199,254,740,991
6464-bit integer18,446,744,073,709,551,61618,446,744,073,709,551,615

An 8-bit byte therefore tops out at 255, which is 11111111 in binary. That is why 255 is the ceiling for each colour channel in a web colour and for each number in an IPv4 address.

How binary arithmetic works in the binary calculator

Binary addition follows the same carrying rule as decimal addition, just with a much smaller alphabet of digits. In decimal, 9 + 1 carries a 1 into the next column because 10 does not fit in one digit. In binary, the same thing happens as soon as a column reaches 2, since binary only has the digits 0 and 1: 1 + 1 = 10 in binary (that is decimal 2), so you write 0 and carry a 1 into the next column, exactly like carrying a 1 when decimal 9 + 1 rolls over to 10.

Worked example. Add 1011 and 110, which are 11 and 6 in decimal. The ones column is 1 + 0 = 1. The twos column is 1 + 1 = 10, so write 0 and carry 1. The fours column is 0 + 1 + the carried 1 = 10, so write 0 and carry 1. The eights column is 1 + 0 + the carried 1 = 10, so write 0 and carry 1 into a new sixteens column. The answer is 10001, which is 17 in decimal, matching 11 + 6.

1011_2 + 110_2 = 10001_2

Binary subtraction borrows in the same way decimal subtraction does. If the top digit in a column is smaller than the one being subtracted, you borrow a 1 from the next column to the left, which is worth 2 in the column you borrowed it into. Knowing how to add binary numbers and how to subtract in binary by hand is worth practicing at least once, even though this page will do both instantly; the full guide to binary addition and subtraction walks through the carry and borrow columns of several examples one step at a time. Binary multiplication and division reduce to the same repeated addition and repeated subtraction you would use in decimal, just with a two-digit alphabet at every step. Rather than track carries and borrows column by column, this calculator converts each binary number to decimal, does the arithmetic, and converts the answer back to binary, which gives an identical result with far less room for a manual mistake.

How binary division works on this calculator

Division is the one operation this calculator does not perform through direct binary manipulation the way binary addition, subtraction and multiplication are traditionally taught column by column. Instead, both binary numbers entered on the Arithmetic tab are first converted to their decimal equivalents, divided using ordinary whole-number division, and the quotient is converted back to binary for display, with the decimal equivalent shown alongside it for a quick check.

Whole-number division means the result is always floored: any remainder is dropped rather than continued into a fractional binary answer. Binary 111 (7) divided by binary 10 (2) gives binary 11, which is decimal 3, not decimal 3.5, since 7 divided by 2 leaves a remainder of 1 that this calculator does not carry forward. Binary fractions exist in principle, using a binary point the same way a decimal point marks fractional digits in base 10, but representing one correctly needs a fixed convention for how many fractional bits to show and how to round or repeat a pattern that does not terminate, exactly the kind of open design decision this calculator avoids by staying within whole numbers only.

Dividing by binary 0 is rejected the same way dividing by decimal 0 is: the calculator has no defined answer to return, so it displays an error rather than a result. Dividing a smaller number by a larger one is allowed and simply returns binary 0, since whole-number division of a smaller value by a larger one always floors to zero: binary 10 (2) divided by binary 101 (5) returns binary 0, matching the ordinary decimal fact that 2 divided by 5 floors to 0.

This decimal-round-trip approach is also why the calculator's practical size limit tracks JavaScript's own safe integer range rather than any limit specific to binary arithmetic: once a binary number's decimal equivalent exceeds 2^53, the intermediate decimal conversion this calculator relies on can no longer represent every value exactly, the same boundary that affects the Convert tab covered elsewhere on this page.

Scope note. This calculator covers non-negative whole numbers only. It does not represent negative binary numbers, the job of a dedicated two's complement converter or binary complement calculator, which represent a negative value using a fixed bit width and a chosen complement convention, a deliberately different and more specialized tool than this one. It also does not represent binary fractions (a binary point with digits after it). Division is whole-number division: the result is floored, with any remainder dropped, rather than continued into a fractional binary answer.

Frequently asked questions

What is binary, and why does a computer use it instead of decimal?

Binary is a number system with only two digits, 0 and 1, instead of decimal’s ten (0 through 9). Computer hardware is built from transistors that are simplest to build and most reliable when they only need to represent two states, off and on, so those two states map directly onto 0 and 1. Every number, letter, image and instruction a computer handles is ultimately stored as a sequence of these binary digits, or "bits".

How do I convert a byte, like 11001010, to decimal by hand?

Line the byte up under the place values 128, 64, 32, 16, 8, 4, 2, 1 (each one double the last, right to left), then add up the place values under every 1. For 11001010 that is 128 + 64 + 8 + 2 = 202. This calculator does the same addition instantly if you type the byte into the binary field.

Why does this calculator not support negative binary numbers?

There is no single agreed-upon way to write a negative number in binary; it depends on a chosen bit width and a convention such as two’s complement, and picking the wrong one silently gives a wrong-looking answer instead of an error. Rather than guess at a width and convention you did not specify, this tool stays within non-negative whole numbers, where the conversion is unambiguous.

Why does 111 divided by 10 give 11 instead of a fraction?

That is 7 divided by 2 in decimal, which is 3.5, not a whole number. Binary fractions exist but need their own careful spec (a binary point, repeating fractional patterns for many decimal fractions, and a rounding rule), which is out of scope here. This calculator uses whole-number division and floors the result, so 111 ÷ 10 lands on binary 11, which is decimal 3.

What does it mean when the calculator says the first number must be greater than or equal to the second?

It means the subtraction would produce a negative result, which this calculator cannot display because it only handles non-negative binary numbers. Swap the two numbers, or subtract the smaller amount from the larger one, and the calculator will show the answer.

Is there a limit to how large a binary number this calculator can handle?

Practically, yes: values are converted through JavaScript’s standard number type, which stays exact up to 2^53. Binary numbers longer than about 53 digits, far beyond anything typically entered by hand, can start losing precision, the same limit any ordinary calculator app runs into.

How is binary different from hexadecimal?

Both are positional number systems used heavily in computing, but binary uses 2 digits (0-1) and hexadecimal uses 16 (0-9 then A-F). Hexadecimal is popular as a shorthand for binary because each hex digit maps neatly onto exactly 4 binary digits, so a long binary string can be written far more compactly in hex. The hex calculator on this site handles that conversion.

Related tools: Factor Calculator, Root Calculator and Fraction Calculator. More are grouped under Math Calculators, and every tool on the site is listed at all calculators.