Number Base & Roman Converter API
Convert integers of any size between bases 2–36 (binary, octal, decimal, hex, base36) and Roman numerals, with grouped binary and hex output.
The base conversion API converts an integer between any bases from 2 to 36 and Roman numerals. Input is detected automatically (0x hex, 0b binary, 0o octal, Roman letters, otherwise decimal) or set with from; underscores and spaces are ignored and negative numbers are allowed. Numbers of any size are supported (no 2^53 limit), which is useful for IDs, hashes and big counters.
By default the result is given in binary, octal, decimal, hexadecimal, base36 and Roman numerals; to=2,16,roman selects the targets. The response also contains grouped binary (nibbles), upper-case hex with prefix, the decimal with thousands separators and the number of bits and bytes needed.
Roman numerals follow the standard subtractive form (IV, IX, XL, CM) from I to MMMCMXCIX (3,999); invalid forms such as IIII or VX are rejected.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
value | query|body | string | yes | The number (e.g. 255, 0xFF, 0b1010, MMXXVI). | |
from | query|body | string | no | auto | auto, roman or a base 2–36. |
to | query|body | string | no | Targets, e.g. 2,16,roman (default: 2, 8, 10, 16, 36, roman). |
Example
curl "https://apibox.io.vn/v1/base-convert?value=MMXXVI" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/base-convert?value=MMXXVI', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/base-convert?value=MMXXVI",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/base-convert?value=MMXXVI');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"input": "MMXXVI",
"from": "roman",
"decimal": "2026",
"results": {
"base2": "11111101010",
"base8": "3752",
"base10": "2026",
"base16": "7ea",
"base36": "1ka",
"roman": "MMXXVI"
},
"formatted": {
"binary": "111 1110 1010",
"hex": "0x7EA",
"grouped": "2,026"
},
"bits": 11,
"bytes": 2
}
Use cases
- Developer tools: bit masks, colour values, memory addresses
- Short IDs in base36
- Teaching number systems
- Roman numerals for chapters, years and clocks
FAQ
Is there a size limit?
Up to 2,000 characters of input; arithmetic uses big integers, so no precision is lost.
Are fractions supported?
No, integers only.
Why is roman null?
Roman numerals only exist for 1–3,999 in the standard notation.
Related APIs
UUID Generator
Generate up to 1,000 UUID v4, time-ordered UUID v7, ULID, Nano ID or random hex IDs per request. Secure randomness, optional uppercase.
⏱Cron Expression Parser
Validate a cron expression and get its next run times in any timezone, with a plain-English description. Supports 5, 6 and 7-field cron syntax.
🕒Time & Timezone Converter
Get the current time in any timezone, convert between timezones and Unix timestamps (seconds or ms), with UTC offset and weekday for up to 30 zones.