Base Calculator
Result
Result
- Decimal
- 17
- Remainder
- 0
Every number base is a rule for turning a string of digits into a value: multiply each digit by the base raised to the power of its position, counting from zero at the right, and add the results. In base 2 the only digits are 0 and 1 and each step to the left doubles: 1011 is 1×8 + 0×4 + 1×2 + 1×1, which is 11. In base 16 the digits run 0 to 9 and then A to F, and each step to the left multiplies by 16: FF is 15×16 + 15, which is 255. This page lets you pick any base from 2 to 36 and then add, subtract, multiply or divide in it. A base is not a different kind of number, it is a different way of writing the same numbers down, which is why the page prints both readings of the answer side by side. 1011 plus 110 in base 2 gives 10001 — and that is 11 plus 6, which is 17, and 17 is 10001 in base 2. Both lines say the same thing; the decimal line is there for readers who do not spend their day in another base. Three things are worth knowing before you start. Digits above nine need symbols, and by long agreement the letters A to Z stand for ten through thirty-five, which is what makes base 36 the largest base that can be written with the characters on a keyboard. A digit is only legal if it is smaller than the base, so 2 is not a digit in base 2 and 1012 is not a binary number even though it looks like one. And the base itself is not part of the answer: 10001 means seventeen only because you said the base was two, so the page prints the digits and leaves the base to the field you chose. The arithmetic is ordinary arithmetic — only the spelling changes. Addition carries when a column reaches the base rather than ten, which is why FF plus 1 rolls over to 100 rather than stopping at FG; there is no G, because sixteen is not a digit. Division is where base arithmetic earns its keep: dividing one number by another gives a quotient and a remainder, and both are printed in your base. The remainder row is always shown. For addition, subtraction and multiplication it is 0, because having nothing left over and leaving a remainder of zero are the same statement for whole numbers. Subtraction can go below zero, and the answer then carries a minus sign written the ordinary way — the sign is not part of the digit set.
The number 255 written in bases 2, 8, 10 and 16, with its place values spelled out
| Base | Written in that base | Place values |
|---|---|---|
| 2 | 11111111 | 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 |
| 8 | 377 | 3×64 + 7×8 + 7 |
| 10 | 255 | 2×100 + 5×10 + 5 |
| 16 | FF | 15×16 + 15 |
Read down the middle column and the same value appears four ways: 11111111, 377, 255 and FF. Nothing about the number changed between the rows — only the symbols and the sizes of the steps. The third column is the arithmetic that turns each spelling back into 255: in base 2 there are eight ones, so the powers 128 down to 1 all appear; in base 16 there are only two digits, but the first is multiplied by 16 rather than by 2. Notice how the width falls as the base rises. Base 2 needs eight digits to say 255, base 8 needs three, base 10 needs three, and base 16 needs two — a larger base says the same value in fewer places, because each place is worth more. That trade is the whole reason bases exist: base 16 is used for bytes not because it is mathematically special but because two of its digits cover exactly one byte, and base 2 is used at the level below that because a wire that can only be on or off has exactly two states. The table does not follow the numbers you typed — the panel above answers those, this shows one value in four spellings.
Formula
1011 + 110 = 10001 in base 2, and 11 + 6 = 17 in base 10 ⇒ 10001 in base 2 is 17, one value written two ways
- b
- The base, a whole number from 2 to 36. It is a plain number box rather than a list of thirty-five choices, so the limits are enforced on the box itself: 1 and 37 are refused before the calculation starts. Base 1 is impossible because a single symbol cannot count past zero, and base 37 would need a thirty-seventh symbol that no keyboard has
- 1011
- Eleven written in base 2: 1×8 + 0×4 + 1×2 + 1×1. Read it right to left, because that is the direction the powers run. The same eleven in base 10 is 11, in base 8 is 13, and in base 16 is B
- 10001
- The answer to 1011 + 110, still in base 2: 1×16 + 0×8 + 0×4 + 0×2 + 1×1, which is 17. Two carries happened on the way — the ones column reached 2 and the fours column reached 2 — and each carry moved one place to the left, exactly as a carry moves in base 10 when a column reaches ten
- FF
- Fifteen times sixteen plus fifteen, which is 255. Base 16 is the base that fits a byte exactly: two hexadecimal digits cover every value from 0 to 255, which is why this base shows up wherever bytes do. A to F are the six digits past nine
- 17 ÷ 5 = 3 r 2
- Division written out. In base 2 the same division is 10001 ÷ 101 = 11 remainder 10, and the page prints the quotient as the result and the remainder on its own row. The remainder is always smaller than the divisor — that is what makes it a remainder rather than a fraction
- A to Z
- The twenty-six extra digits that carry base 10 up to base 36. A is ten, B is eleven, and Z is thirty-five. Capital and small letters both work, and the page prints capitals
Reading a value out of a system that speaks another base is the everyday use. A memory dump prints bytes as pairs of hexadecimal digits, a file permission shows as 755 because each of the three digits packs three bits, a subnet mask is four groups of eight bits, and an IPv6 address is hexadecimal throughout. In each case the decimal value is not what you want — you want to see the base the machine sees. Writing to the same systems is the mirror case: setting a register bit pattern, building a colour from its red, green and blue bytes, or working out why a shifted value came out negative all mean doing arithmetic in a base that is not ten. In coursework base arithmetic is taught as the thing that shows a place-value system is a choice rather than a fact, and the exercises are exactly what this page does — carry in base 2, borrow in base 8, and see that the same operation gives the same answer in every base once both sides are read in the same one. A fourth use is checking your own work: if 1011 plus 110 in base 2 gives something other than 17 in decimal, one of the two readings is wrong, and having both on the page is what makes that check possible. When the base is 2 or 16 specifically, the dedicated pages go deeper — binary-calculator and hex-calculator are this same arithmetic with the base already filled in, and the two converter pages handle going from one base to another without an operation in between.
Worked examples
Adding in base 2: 1011 + 110
- Read both operands in decimal to know what you are adding: 1011 is 11 and 110 is 6
- 11 + 6 = 17
- Write 17 in base 2: 17 = 16 + 1, so the digits are 1 0 0 0 1
- The base-2 answer is 10001, and the decimal row confirms it is 17
The default input, and the one the table below walks through in a different base. Adding the two strings column by column gives the same answer: 1 + 0 is 1, 1 + 1 is 0 carry 1, then 0 + 1 plus the carry is 0 carry 1, and the last carry lands in a new column on the left. Carrying when a column reaches 2 is the whole of base-2 addition; the carries are what make 10001 five digits wide when the operands were four and three.
Carrying past the last digit: FF + 1 in base 16
- FF is 15×16 + 15 = 240 + 15 = 255
- Adding 1 gives 256
- Write 256 in base 16: 256 = 1×256 + 0×16 + 0, so the digits are 1 0 0
- The answer is 100 in base 16 — which is 256, not one hundred
The trap this example exists for: 100 is a small number in base 10 and a much larger one in base 16. A column-by-column reading shows why it comes out that wide — F plus 1 is sixteen, which is not a digit in base 16, so it carries and leaves 0 behind, and the carried 1 lands on a full F, which carries again. One addition moved the answer up two places. This is the same event as 99 + 1 giving 100 in base 10, and it is the reason a byte rolling over from 255 to 256 needs a second byte.
Division with a remainder: 1011 ÷ 10 in base 2
- 1011 is 11 and 10 is 2
- 11 ÷ 2 = 5 remainder 1
- Write 5 in base 2: 5 = 4 + 1, so the digits are 1 0 1
- The quotient is 101 and the remainder row reads 1 — and 101 is 5, which the decimal row confirms
The only one of the four operations whose remainder is not zero, which is why the remainder row is on the page at all. Note that the quotient is the whole part only: 11 divided by 2 is 5.5, and the page prints 101 with a remainder of 1 rather than 10.1 or 101.1, because a remainder keeps the answer in whole numbers — the half is sitting in that 1. The check is 5 × 2 + 1 = 11, and it holds in every base.
Limitations
The base must be a whole number from 2 to 36. One is impossible because a single digit cannot express any value but zero, and thirty-seven would need a thirty-seventh symbol; the field refuses both before the calculation starts. Decimals and fractions are refused rather than rounded, and so is a minus sign in front of an operand: the page parses digits, and a sign or a point is not a digit. A digit that is too large for the base you chose is a separate case, and it is worth being plain about how it is handled. Type 1012 with the base set to 2 and you will get a general calculation error rather than a message naming the offending digit. That is a deliberate trade rather than an oversight: the check on the input box is handed the string and nothing else, so it cannot read the base field beside it, and the honest options were to accept any string of digits that could be legal in some base, or to accept anything at all. The page took the first. The practical effect is that the box stays clean and the error appears in the result panel instead — the answer is never wrong, it is just explained less well. Both operands are capped at sixty characters and at the largest whole number a double can hold exactly, 9007199254740991, which is sixteen digits in base 10 and about fifty in base 2. The answer is subject to the same ceiling: it is computed exactly and then checked, so an operation whose result runs past it is refused rather than printed as a rounded value. Letters may be typed in either case and are printed in capitals, so ff and FF are the same input. Leading zeros are accepted and ignored, which means 00001011 and 1011 are the same number and both are printed as 1011. The reference table below is fixed at 255 in bases 2, 8, 10 and 16 and does not follow what you typed — the panel answers your numbers, the table shows the four spellings of one value side by side.
Frequently asked questions
- How do I add two numbers in a base that is not ten?
- Add column by column from the right, exactly as in base 10, but carry when a column reaches the base instead of when it reaches ten. In base 2 the only carry threshold is 2: 1 + 1 is 0 carry 1. So 1011 + 110 is 10001, because the twos column and the fours column each overflowed and pushed a 1 into the next place. If you would rather not track carries, convert both operands to decimal, do the arithmetic there, and convert back — that is what the decimal row on this page is showing, and it gives the same answer every time.
- Why did 1012 fail when the base is 2?
- Because 2 is not a digit in base 2 — the digits are 0 and 1 and nothing else. The rule is that a digit must be smaller than the base, so base 2 allows 0 and 1, base 8 allows 0 to 7, base 10 allows 0 to 9, and base 16 allows 0 to 9 and A to F. You will see this as a general calculation error rather than a message naming the digit, and that is a known rough edge: the check on the input box can only see the string you typed, not the base you picked, so it accepts any string of digits that could be legal in some base and leaves the base-specific check to the calculation. The answer is never wrong, but the explanation is thinner than it should be.
- Which bases can I use, and why does it stop at 36?
- Any whole number from 2 to 36. The ceiling is a keyboard, not mathematics: digits above nine need symbols, the conventional symbols are the letters A to Z, and there are twenty-six of them — ten plus twenty-six is thirty-six. Base 1 is impossible for a different reason: with only one digit you cannot write any value above zero, because every place would be worth 1 and there would be no way to reach 2.
- Is 100 in base 16 the same as one hundred?
- No, and this is the mistake the page's second example exists to head off. In base 16, 100 means 1×256 + 0×16 + 0, which is 256. The digits are the same characters but the places are worth sixteen times as much each step instead of ten times, so the same three symbols stand for a different value. The decimal row on the page is there precisely so you never have to guess which reading is meant.
- Why is the remainder always shown, even for addition?
- Because for whole numbers, leaving no remainder and leaving a remainder of zero are the same statement, and a row that appears and disappears is harder to read than a row that is always there. For addition, subtraction and multiplication the row reads 0. Only division can produce a non-zero remainder, and there the row carries the part that did not divide evenly — 1011 ÷ 10 in base 2 leaves 1, which is the half of 11 ÷ 2 that the quotient dropped.
- Can I do arithmetic in base 10 on this page?
- Yes, and it is a useful way to check that the page agrees with an ordinary calculator: set the base to 10 and everything behaves exactly as you expect, because the digits, the carries and the answer format are unchanged. What you gain is the remainder row and the explicit statement of the base, and what you lose is nothing. The neighbours go the other way — binary-calculator and hex-calculator are this same arithmetic with the base already set to 2 and 16, and the converters handle changing a value from one base to another without an operation in between.
References
- Base — what a positional number system is, how the digits of a base b expansion are read, and why the base must be a whole number greater than 1 — Wolfram MathWorld (United States)
- Hexadecimal — the base-16 system, the six letters past nine, and the convention that makes two hex digits equal one byte — Wolfram MathWorld (United States)
- Binary — the base-2 system and the place values 1, 2, 4, 8 that its digits stand for — Wolfram MathWorld (United States)
- 教育部关于印发义务教育课程方案和课程标准(2022 年版)的通知——The fifth item in the annex list of this notice is the Mathematics Curriculum Standards for Compulsory Education (2022 edition); the decimal system and binary are part of the content where the information technology and mathematics curricula meet, and the wording of the standards and the grade-band breakdown are governed by that annex — 中华人民共和国教育部