Base-N Calculator
Convert and calculate numbers in any base from 2 to 36. Perform arithmetic, bitwise operations, and instant multi-base conversions.
About
Positional numeral systems encode quantity through digit placement relative to a radix r. A single misread digit in a hexadecimal memory address corrupts an entire data segment. Firmware engineers routinely convert between base-2, base-8, base-16, and base-10 under time pressure where manual errors cascade into hardware faults. This calculator performs exact arbitrary-precision integer arithmetic and conversion across all standard bases from 2 to 36, using digits 0 - 9 and letters A - Z. It validates every digit against the selected radix before computation, eliminating silent truncation bugs found in many online converters.
The tool handles numbers exceeding 264 via arbitrary-precision integer support. Arithmetic operations (addition, subtraction, multiplication, integer division, modulo, exponentiation) and bitwise operations (AND, OR, XOR, NOT, left/right shift) are computed exactly. Note: fractional base conversion uses fixed precision of 20 fractional digits and may exhibit rounding in non-terminating expansions (e.g., 0.1 in base 10 is non-terminating in base 2).
Formulas
A number N expressed in base r with digits dk has the decimal value:
where dk โ {0, 1, โฆ, r โ 1} and k = 0 is the least significant digit.
To convert a decimal integer to base r, repeatedly divide by r and collect remainders in reverse order:
For fractional parts, multiply by r and extract integer parts successively. This process may not terminate (e.g., 0.110 in base 2 is 0.0001100110011โฆ).
Bitwise operations treat the number as a binary string. For two integers a and b:
a OR b โ bit-by-bit logical disjunction
a XOR b โ bit-by-bit exclusive or
NOT a โ bitwise complement
a << n โก a ร 2n
a >> n โก โa รท 2nโ
where r = radix (base), dk = digit at position k, N = numeric value, n = number of digit positions or shift amount.
Reference Data
| Base | Name | Digits Used | Common Use | Example: 25510 |
|---|---|---|---|---|
| 2 | Binary | 0-1 | Digital circuits, CPU instructions | 11111111 |
| 3 | Ternary | 0-2 | Balanced ternary computers, information theory | 100110 |
| 4 | Quaternary | 0-3 | DNA nucleotide encoding | 3333 |
| 5 | Quinary | 0-4 | Tally systems, Bi-quinary coded decimal | 2010 |
| 6 | Senary | 0-5 | Dice notation, some natural languages | 1103 |
| 7 | Septenary | 0-6 | Days of the week, historical calendars | 513 |
| 8 | Octal | 0-7 | Unix file permissions, PDP-11 architecture | 377 |
| 10 | Decimal | 0-9 | Human counting, finance, science | 255 |
| 12 | Duodecimal | 0-9, A - B | Time (12 hours), imperial units (dozen) | 193 |
| 16 | Hexadecimal | 0-9, A - F | Memory addresses, color codes, MAC addresses | FF |
| 20 | Vigesimal | 0-9, A - J | Maya numerals, French numbering (quatre-vingts) | CF |
| 32 | Base32 | 0-9, A - V | Crockford encoding, TOTP secret keys | 7V |
| 36 | Base36 | 0-9, A - Z | URL shorteners, compact alphanumeric IDs | 73 |
| 58 | Base58 * | Alphanumeric minus 0OIl | Bitcoin addresses, IPFS hashes | Not supported (non-standard) |
| 64 | Base64 * | A - Z, a - z, 0-9, +/ | Email encoding (MIME), data URIs | Not supported (encoding, not positional) |