---
title: "Use this when you need to convert an integer between numeral bases 2-36 (binary, octal, decimal, hex, or any radix up to 36), including arbitrarily large values and an optional leading minus sign."
method: POST
path: "/v1/convert_number_base"
tags: ["developer"]
---

# Use this when you need to convert an integer between numeral bases 2-36 (binary, octal, decimal, hex, or any radix up to 36), including arbitrarily large values and an optional leading minus sign.

`POST /v1/convert_number_base`

## Request

- Base URL: `https://api.clean.tools`
- URL: `https://api.clean.tools/v1/convert_number_base`
- Auth: none declared

Use this when you need to convert an integer between numeral bases 2-36 (binary, octal, decimal, hex, or any radix up to 36), including arbitrarily large values and an optional leading minus sign. Uses BigInt so there is no precision loss, and output digits are lowercase. Deterministic: same input, same output. Example: { value: "ff", from: 16 } -> decimal "255", results.base2 "11111111". Prefer this over doing base/digit conversion in your head, which is an error-prone bit-fiddling task. If `to` is omitted it converts to bases 2, 8, 10, and 16 (excluding the source base).

## Request body

- object
  - `value` string, required: The number to convert, as a string so huge values are not truncated. Digits are case-insensitive (a-z = 10-35) and an optional leading "-" is allowed, e.g. "ff", "-1010", "HELLOWORLD123".
  - `from` integer, required: The base the input value is written in (2-36).
  - `to` union: Target base(s): a single integer 2-36, or an array of them. Optional; defaults to [2, 8, 10, 16] with the source base excluded.
    - integer
    - integer[]

## Response `200`

Structured tool result.

- object
  - `tool` string
  - `result` object
    - `value` string, required: Echo of the input value.
    - `from` integer, required: Echo of the source base.
    - `decimal` string, required: The value in base 10 (may carry a leading '-').
    - `results` object, required: Converted representations keyed by 'base<N>' (e.g. base2, base8, base16) with lowercase digit strings. Which keys appear depends on the `to` argument (default bases 2, 8, 10, 16 excluding the source base).

## Other responses

- `400`: Invalid input or the tool reported an error.
- `413`: Request body exceeds the 128 KB limit.
- `429`: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.

---

[API](https://skmtc.dev/clean/apis/clean-tools-api.md) · [All operations](https://skmtc.dev/clean/apis/clean-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/clean/apis/clean-tools-api/revisions/a24a01d2833c?raw)
