# 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.

- Calculator id: `base-converter` · Category: Math (`math`) · Tool name: `convert_number_base`
- Canonical page: https://tttkmbb.com/math/base-converter · This document: https://tttkmbb.com/math/base-converter.md · JSON definition: https://tttkmbb.com/math/base-converter.json

## Purpose

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.

**Use when:** 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).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | string |  | required | 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 |  | optional, default 10 | Base of the input value. (min 2, max 36) |
| `to_base` | integer |  | optional, default 2 | Base of the result. (min 2, max 36) |

## Output

| Field | 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. |

## Formula

`value = Σ dᵢ × from_base^i (digits read right to left); the result digits are the remainders of repeated division by to_base`

## Data Sources

- Wikipedia – Radix — https://en.wikipedia.org/wiki/Radix (reference, retrieved 2026-09-23)
- Wikipedia – Positional notation — https://en.wikipedia.org/wiki/Positional_notation (reference, retrieved 2026-09-23)
- Wolfram MathWorld – Base — https://mathworld.wolfram.com/Base.html (reference, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/base-converter?value=…`
- `POST https://tttkmbb.com/api/v1/calculate/base-converter` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/base-converter · OpenAPI operationId `convert_number_base` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "base-converter", "inputs": {…}}`

## Example

- ff (hex) to decimal: inputs `{"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: inputs `{"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
```

## Limitations

The value has a fractional part, you need Roman numerals (use roman-numeral) or byte/bit unit conversions (use data-storage). All values are computed from the formula above; no measurement or live data is involved.

## 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

- [Modulo Calculator](https://tttkmbb.com/math/modulo.md) — Remainders used by the conversion algorithm.
- [Data Storage Converter](https://tttkmbb.com/conversion/data-storage.md) — Convert between bits, bytes and larger units.
- [Roman Numeral Converter](https://tttkmbb.com/everyday/roman-numeral.md) — A non-positional numeral system.
