Binary Calculator
Creator
Reviewer
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.
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
| 8 | 1000 |
| 9 | 1001 |
| 10 | 1010 |
| 11 | 1011 |
| 12 | 1100 |
| 13 | 1101 |
| 14 | 1110 |
| 15 | 1111 |
| 16 | 10000 |
| 17 | 10001 |
| 18 | 10010 |
| 19 | 10011 |
| 20 | 10100 |
| 21 | 10101 |
| 22 | 10110 |
| 23 | 10111 |
| 24 | 11000 |
| 25 | 11001 |
| 26 | 11010 |
| 27 | 11011 |
| 28 | 11100 |
| 29 | 11101 |
| 30 | 11110 |
| 31 | 11111 |
| 32 | 100000 |
| 33 | 100001 |
| 34 | 100010 |
| 35 | 100011 |
| 36 | 100100 |
| 37 | 100101 |
| 38 | 100110 |
| 39 | 100111 |
| 40 | 101000 |
| 41 | 101001 |
| 42 | 101010 |
| Decimal | Binary |
|---|---|
| 43 | 101011 |
| 44 | 101100 |
| 45 | 101101 |
| 46 | 101110 |
| 47 | 101111 |
| 48 | 110000 |
| 49 | 110001 |
| 50 | 110010 |
| 51 | 110011 |
| 52 | 110100 |
| 53 | 110101 |
| 54 | 110110 |
| 55 | 110111 |
| 56 | 111000 |
| 57 | 111001 |
| 58 | 111010 |
| 59 | 111011 |
| 60 | 111100 |
| 61 | 111101 |
| 62 | 111110 |
| 63 | 111111 |
| 64 | 1000000 |
| 65 | 1000001 |
| 66 | 1000010 |
| 67 | 1000011 |
| 68 | 1000100 |
| 69 | 1000101 |
| 70 | 1000110 |
| 71 | 1000111 |
| 72 | 1001000 |
| 73 | 1001001 |
| 74 | 1001010 |
| 75 | 1001011 |
| 76 | 1001100 |
| 77 | 1001101 |
| 78 | 1001110 |
| 79 | 1001111 |
| 80 | 1010000 |
| 81 | 1010001 |
| 82 | 1010010 |
| 83 | 1010011 |
| 84 | 1010100 |
| 85 | 1010101 |
| Decimal | Binary |
|---|---|
| 86 | 1010110 |
| 87 | 1010111 |
| 88 | 1011000 |
| 89 | 1011001 |
| 90 | 1011010 |
| 91 | 1011011 |
| 92 | 1011100 |
| 93 | 1011101 |
| 94 | 1011110 |
| 95 | 1011111 |
| 96 | 1100000 |
| 97 | 1100001 |
| 98 | 1100010 |
| 99 | 1100011 |
| 100 | 1100100 |
| 101 | 1100101 |
| 102 | 1100110 |
| 103 | 1100111 |
| 104 | 1101000 |
| 105 | 1101001 |
| 106 | 1101010 |
| 107 | 1101011 |
| 108 | 1101100 |
| 109 | 1101101 |
| 110 | 1101110 |
| 111 | 1101111 |
| 112 | 1110000 |
| 113 | 1110001 |
| 114 | 1110010 |
| 115 | 1110011 |
| 116 | 1110100 |
| 117 | 1110101 |
| 118 | 1110110 |
| 119 | 1110111 |
| 120 | 1111000 |
| 121 | 1111001 |
| 122 | 1111010 |
| 123 | 1111011 |
| 124 | 1111100 |
| 125 | 1111101 |
| 126 | 1111110 |
| 127 | 1111111 |
| 128 | 10000000 |
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.
| Bits | Common name | Values (2^n) | Largest number |
|---|---|---|---|
| 1 | Bit | 2 | 1 |
| 4 | Nibble | 16 | 15 |
| 8 | Byte | 256 | 255 |
| 16 | 16-bit integer | 65,536 | 65,535 |
| 32 | 32-bit integer, IPv4 address | 4,294,967,296 | 4,294,967,295 |
| 53 | Largest exact integer in this calculator | 9,007,199,254,740,992 | 9,007,199,254,740,991 |
| 64 | 64-bit integer | 18,446,744,073,709,551,616 | 18,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.
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?
How do I convert a byte, like 11001010, to decimal by hand?
Why does this calculator not support negative binary numbers?
Why does 111 divided by 10 give 11 instead of a fraction?
What does it mean when the calculator says the first number must be greater than or equal to the second?
Is there a limit to how large a binary number this calculator can handle?
How is binary different from hexadecimal?
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.
