A number base calculator that works exactly, on integers of any size: convert between any bases from 2 to 36 (binary, octal, decimal and hexadecimal included), with every digit validated against the base and the conversion steps shown; do arithmetic (+, −, ×, ÷ with remainder) on numbers written in any bases; and run bitwise operations on fixed-width patterns with the two’s complement convention stated out loud, so a row of ones reads as 255 or as −1 depending on a choice you can see, not a guess the tool makes silently.
Digits are 0–9 then A–Z for bases above 10 (case-insensitive). Spaces and underscores between digits are ignored, so 1111 1111 is fine. Matching prefixes are accepted: 0b for binary, 0o for octal, 0x for hexadecimal. Integers only: fractional values in other bases are a different tool, and the limitations say why.
How to use this calculator
- Convert: type the number, pick its base and the target base. You get the converted value (grouped for readability), a table with the same value in binary, octal, decimal and hexadecimal, and the working: repeated division when converting from decimal, positional expansion when converting to it.
- Signed input: a leading minus is normally kept as a sign (sign-magnitude). If your digits are a machine bit pattern instead, choose the two’s complement convention and a width: the pattern is then read as a signed machine integer, and binary-family outputs show both the signed value and the padded pattern.
- Arithmetic: two numbers, each in its own base, one operation, and a result base. Division reports the quotient and the remainder, in the result base and in decimal.
- Bitwise: two patterns and a width. Operands are fitted into the width as two’s complement patterns, the operation runs on the patterns, and the result is shown as the padded pattern, its unsigned value, and its signed (two’s complement) reading.
The method
What a base means
Every conversion here runs through the exact integer value (arbitrary precision, no floating point anywhere), so a 64-bit pattern or a 40-digit decimal converts without the rounding that plagues float-based converters. Digits are validated one by one: base 2 accepts only 0 and 1, base 16 runs to F, base 36 runs to Z, and an offending digit is named in the error rather than silently dropped or clamped.
Two’s complement, stated explicitly
In a width of W bits, the pattern of all ones is the unsigned number 2W − 1 and the signed number −1; the convention decides which reading a pattern gets. This tool never guesses: the sign convention is a visible control, patterns that do not fit the chosen width are refused with the range named, and bitwise results always report both the unsigned value and the signed reading of the result pattern, so the convention’s effect is on the page rather than in the fine print.
Arithmetic and overflow
Conversion and arithmetic are exact and unbounded: FF + 1 in hexadecimal is 100, and multiplying two 30-digit numbers loses nothing. The only place width binds is the bitwise mode (and two’s complement input), where the width is the point of the exercise: operands are masked into the width, shifts push bits out of the pattern, and NOT flips exactly the bits inside it.
Worked examples
Example 1: decimal 255, everywhere
255 in decimal is FF in hexadecimal, 11111111 in binary, and 377 in octal. The division steps show why: 255 ÷ 16 = 15 remainder 15 (F), then 15 ÷ 16 = 0 remainder 15 (F), and the remainders read upward spell FF. The preloaded conversion.
Example 2: hexadecimal FF to decimal
FF = F×16 + F = 15×16 + 15 = 240 + 15 = 255. Positional expansion, one term per digit, is the whole method; the tool lists the terms so the arithmetic can be checked digit by digit.
Example 3: binary 1010
1010 in binary is 8 + 2 = 10 in decimal and the single digit A in hexadecimal. Grouping binary digits in fours (1010) is exactly the hex conversion, which is why programmers read hex as compressed binary.
Example 4: base 36
The largest single digit, Z, is worth 35, and 1295 in decimal is ZZ in base 36 (35×36 + 35). Bases above 16 exist precisely for compact encodings like this, and the digit validation follows the same rule: in base b, digits run from 0 to the (b−1)th symbol.
Example 5: one pattern, two readings
11111111 in binary at width 8 is 255 unsigned and −1 as a two’s complement signed byte. Both readings are correct; they are answers to different questions, and the sign-convention control is where you say which question you are asking.
Example 6: hexadecimal addition
FF + 1 = 100 in hexadecimal (255 + 1 = 256 in decimal, and 256 = 1×16²). The arithmetic mode shows the decimal equivalents it worked through, so a hex sum can be audited in the base you think in. The preloaded arithmetic.
Example 7: binary multiplication and division
1010 × 101 (binary) = 10 × 5 = 50 = 110010 in binary. And 100 ÷ 7 in decimal gives quotient 14, remainder 2, since 14×7 + 2 = 100; division here is integer division with the remainder reported, not a fraction in disguise.
Example 8: bitwise on a byte
A = 1100, B = 1010 at width 8: AND gives 00001000 (8), OR gives 00001110 (14), XOR gives 00000110 (6), NOT A gives 11110011 (unsigned 243, signed −13), A << 1 gives 00011000 (24), and A >> 2 gives 00000011 (3). The preloaded bitwise example.
Reading your results
The grouped display is cosmetic; the value is exact. Binary is grouped in fours and hexadecimal in twos (bytes) purely so long strings can be read; the ungrouped string is the same number. Letter digits are uppercase by convention, and input case never matters.
The all-bases table is the cross-check. If a conversion looks wrong, the table usually exposes which base was mis-set: the value that “should” be the answer typically appears in the row of the base you actually meant. Most real-world conversion errors are base-selection errors, not arithmetic ones, and the table is designed to catch them.
Signed readings always name their width. A pattern has no signed value until a width and a convention are fixed; results here carry both (“8-bit pattern …, signed −13”) so a screenshot of the answer stays unambiguous later.
Common mistakes
- Reading a hex string as decimal (or the reverse). “100” is 100, 256, 512 or 46656 depending on whether the base is 10, 16, 8 or 36. The base is part of the number; the all-bases table makes the alternatives visible.
- Assuming a bit pattern is negative (or positive) on sight. 11111111 is 255 until a width and a signed convention make it −1. Tools that silently pick one are how off-by-sign bugs are born; this one makes you pick, and labels the output.
- Forgetting that bitwise shifts are width-bound. In 8 bits, 1100 << 5 is 10000000 with the rest pushed out, not the unbounded 110000000 of pure arithmetic. The width is applied first, then the shift.
- Losing the remainder. Integer division in bases produces a quotient and a remainder; reporting only a decimal fraction of the quotient smuggles base-10 fractions into a base where they may not even terminate. Both parts are reported here, in both bases.
- Typing digits the base does not have. 102 is not “a bit wrong” in binary, it is not a binary number at all. The error names the digit and the base’s legal range, which is faster than hunting for the bad character yourself.
- Expecting fractions. 0.1 in decimal has no finite binary form (it recurs), and this page is integers-only by design; see the limitations.
Limitations
- Integers only. Fractional numbers in non-decimal bases are deliberately out of scope: many terminate in one base and recur in another (0.1 decimal in binary), and honest fractional support needs a stated precision convention, which belongs to a dedicated tool rather than being bolted on here.
- Bases run from 2 to 36, the range the digit alphabet 0–9, A–Z supports. Base 64 and friends are encodings with different alphabets and padding rules, not positional bases in this sense.
- Two’s complement and bitwise widths are 8, 16, 32 and 64 bits, the machine widths in everyday use. Wider patterns can still be converted and added exactly in the other modes, just without a signed-width reading.
- Shift right is logical (zeros enter from the left), which matches the pattern view; an arithmetic shift that replicates the sign bit is a different operation and is not silently substituted.
Frequently asked questions
How do you convert binary to hexadecimal by hand?
Group the binary digits in fours from the right and translate each group into one hex digit: 1111 1111 becomes F F. It works because 16 is 2⁴, so each hex digit is exactly a 4-bit pattern. The all-bases table on this page shows the groupings, which is the fastest way to build the intuition.
Why is 0.1 so strange in binary?
Because a fraction terminates in base b only when its denominator’s prime factors all divide b. One tenth has denominator 10 = 2 × 5, and 5 does not divide 2, so decimal 0.1 becomes an infinitely recurring binary fraction, which is why this page stays with integers and says so.
What is the difference between signed and unsigned?
Nothing in the bits; everything in the reading. An unsigned byte runs 0 to 255. A signed (two’s complement) byte spends half its patterns on negatives and runs −128 to 127, with the top bit acting as the sign. The same pattern 11111111 is 255 in the first world and −1 in the second, and any tool that shows you one without naming the convention is leaving half the answer off.
Why does division give two answers?
Because integer division is quotient plus remainder: 100 ÷ 7 is 14 remainder 2, and 14 × 7 + 2 = 100 reconstructs the input. A single “14.2857…” answer would be decimal-fraction thinking, meaningless in base 7 or base 2 until a fractional convention is chosen.
What are bases above 16 used for?
Compactness. Base 36 squeezes a number into the fewest characters the alphanumeric alphabet allows, which is why short codes and identifiers use it. The positional rule is unchanged; only the digit alphabet grows, up to Z for 35.
Does FF + 1 really equal 100?
In hexadecimal, yes: FF is 255, plus 1 is 256, and 256 is 1×16² + 0×16 + 0, written 100. The carry behaves exactly as in decimal, it just happens after F instead of after 9, which the arithmetic mode’s decimal audit line confirms.
Related calculators
- Math calculators
- Subnet Calculator: the binary patterns of this page at work in IP addressing.
Method: all values are held as exact arbitrary-precision integers. Conversion to decimal evaluates the positional sum digit by digit; conversion from decimal uses repeated division with remainders read upward; digits are validated against the base before any arithmetic. Two’s complement readings use the width you select (patterns must fit it); bitwise operations run on the width-masked patterns and report both unsigned and signed readings of the result. Last reviewed: 21 October 2026.
Disclaimer: This calculator gives estimates for general information only. It is not financial, medical or other professional advice.
