Number Base Converter
Convert a number between binary, octal, decimal, hexadecimal and base 36 at once.
Formula and sources updated · Data sources · 1View algorithm, constants and default inputs (JSON)
Decimal (base 10)
About this calculator
Convert non-decimal integers between bases 2, 8, 10, 16 and 36. A leading 0b, 0o or 0x prefix is accepted only with its matching base selected. Negative integers are supported; decimal fractions are not. Arithmetic is exact for inputs up to 4,096 digits.
Worked example
calculated with the default values below
Value to convert 255 · Input base Decimal (base 10) Decimal (base 10) 255 · Binary (base 2) 11111111 · Octal (base 8) 377 · Hexadecimal (base 16) FF · Base 36 73
Method and assumptions
n ← n × B + dᵢ (i = 1 … m); K = ⌊log_b n⌋ + 1; e_k = x mod b, x ← ⌊x ÷ b⌋ (k = 1 … K) Exact BigInt conversion for bases 2/8/10/16/36. A prefix 0x/0b/0o is accepted only with its matching source base. Invalid digits suppress results and show an error. Signs are preserved; zero renders as one digit. Convert non-decimal integers between bases 2, 8, 10, 16 and 36. A leading 0b, 0o or 0x prefix is accepted only with its matching base selected. Negative integers are supported; decimal fractions are not. Arithmetic is exact for inputs up to 4,096 digits. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Data sources
The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Disclaimer
These calculators give general mathematical results. They suit study, planning and estimation — verify anything that feeds a graded submission, a published figure or a financial commitment.
Implementation source
This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.
Formula and variables
n ← n × B + dᵢ (i = 1 … m); K = ⌊log_b n⌋ + 1; e_k = x mod b, x ← ⌊x ÷ b⌋ (k = 1 … K)
- dᵢ
- Source-base digit, 0 ≤ dᵢ < B
- m
- Number of source digits
- B
- Source base
- n
- Decimal value
- b
- Target base
- K
- Number of target digits
- x
- Value being converted; x ← n initially
- e_k
- k-th target-base digit
Exact BigInt conversion for bases 2/8/10/16/36. A prefix 0x/0b/0o is accepted only with its matching source base. Invalid digits suppress results and show an error. Signs are preserved; zero renders as one digit.
Frequently asked questions
Why do programmers use hexadecimal instead of decimal?
Hexadecimal is compact for binary because 16 is 2⁴: each hex digit represents exactly four bits, so a byte can be written as two hex digits. Octal works similarly because 8 is 2³, so each octal digit represents three bits. Decimal is not a power of two, so its digits do not group binary bits into fixed-size chunks.
Are hexadecimal letters case-sensitive in this calculator?
No. The input is converted to lowercase before parsing, so A and a both represent ten in base 16. Choose the correct “from base” setting; the calculator checks each digit against it. A prefix such as 0x is optional for hexadecimal input here and is stripped before parsing.
Which inputs and limits apply to Number Base Converter?
Use the units shown beside each field. These are form limits, not recommended settings. n ← n × B + dᵢ (i = 1 … m); K = ⌊log_b n⌋ + 1; e_k = x mod b, x ← ⌊x ÷ b⌋ (k = 1 … K) Exact BigInt conversion for bases 2/8/10/16/36. A prefix 0x/0b/0o is accepted only with its matching source base. Invalid digits suppress results and show an error. Signs are preserved; zero renders as one digit. Convert non-decimal integers between bases 2, 8, 10, 16 and 36. A leading 0b, 0o or 0x prefix is accepted only with its matching base selected. Negative integers are supported; decimal fractions are not. Arithmetic is exact for inputs up to 4,096 digits. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
What is a complete worked example for Value to convert = 255; Input base = Decimal (base 10)?
Inputs: Value to convert = 255; Input base = Decimal (base 10). Calculation: n ← n × B + dᵢ (i = 1 … m); K = ⌊log_b n⌋ + 1; e_k = x mod b, x ← ⌊x ÷ b⌋ (k = 1 … K). Results: Decimal (base 10) = 255; Binary (base 2) = 11111111; Octal (base 8) = 377; Hexadecimal (base 16) = FF; Base 36 = 73.