Home › Math › Number Base Converter
Number Base Converter
Converts an integer written in one base (2–36) to another, using exact arbitrary-precision arithmetic, and always shows the binary, octal, decimal and hexadecimal forms.
When to use
You need to convert between binary, octal, decimal, hexadecimal or any positional base up to 36, including large integers.
Do not use when: The value has a fractional part, you need Roman numerals (use roman-numeral) or byte/bit unit conversions (use data-storage).
Formula
value = Σ dᵢ × from_base^i (digits read right to left); the result digits are the remainders of repeated division by to_base
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
value | string | yes | Integer written in the source base, e.g. 'ff' or '1010'. Letters a–z stand for digits 10–35 (case-insensitive); an optional leading '-' and the prefixes 0x, 0o, 0b are accepted. | |
from_base | integer | default 10 | Base of the input value. Range: ≥ 2, ≤ 36 | |
to_base | integer | default 2 | Base of the result. Range: ≥ 2, ≤ 36 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
result | string | The number written in to_base (digits above 9 as uppercase letters). | |
decimal | string | Exact base-10 representation (a string so that very large values are not rounded). | |
decimal_value | number | Base-10 value as a number; omitted when it exceeds 2^53. | |
binary | string | Base-2 representation. | |
octal | string | Base-8 representation. | |
hexadecimal | string | Base-16 representation. |
Example
ff (hex) to decimal: {"value":"ff","from_base":16,"to_base":10} → {"result":"255","decimal":"255","decimal_value":255,"binary":"11111111","octal":"377","hexadecimal":"FF"}
1010 (binary) to hex: {"value":"1010","from_base":2,"to_base":16} → {"result":"A","decimal":"10","decimal_value":10,"binary":"1010","octal":"12"}
GET https://tttkmbb.com/api/v1/calculate/base-converter?value=ff&from_base=16&to_base=10
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/base-converter(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/base-converter · Markdown: https://tttkmbb.com/math/base-converter.md · JSON definition: https://tttkmbb.com/math/base-converter.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="base-converter" - OpenAPI operationId:
convert_number_base - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Radix (reference)
- Wikipedia – Positional notation (reference)
- Wolfram MathWorld – Base (reference)
FAQ
Are negative numbers supported?
Yes, with a leading minus sign (sign-magnitude form). Two's-complement bit patterns are not interpreted.
What about fractions like 0.1 in binary?
Not supported; only integers are converted. Multiply by a power of the base first if you need fixed-point digits.
Related calculators
- Modulo Calculator — Remainders used by the conversion algorithm.
- Data Storage Converter — Convert between bits, bytes and larger units.
- Roman Numeral Converter — A non-positional numeral system.