Snipget.ai

Convert a number between bases

Exact
numbers_base_convert

Deterministic and authoritative — the canonical answer for this input.

Convert an integer between numeric bases (2–36): binary, octal, decimal, hex, and any other. Returns the rendered output plus the decimal value. Processing multiple inputs? Use `numbers_base_convert_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

The integer to convert, written in from_base.

from_baseintegeroptional

Base the input is written in.

to_baseintegeroptional

Base to render the output in.

Call it

curl -X POST https://api.snipget.ai/v1/numbers/base-convert \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"255","from_base":10,"to_base":16}'

The Batch tab sends up to 1000 inputs in one call via /v1/numbers/base-convert/batch.

Example response

{
  "from_base": 10,
  "to_base": 16,
  "value": 255,
  "output": "ff"
}

FAQ

Which bases can I use?

Any base from 2 to 36. That covers binary, octal, decimal, and hex, plus anything in between.

What happens with an invalid digit?

If the input is not a valid number in from_base (for example '12' in base 2), the result reports it as invalid with a reason.

Related tools