Convert number base
101101 in binary is 2D in hexadecimal. Convert a whole number between any two bases from 2 to 36, and every digit is checked against its base first, so a slip like 102 in binary is caught instead of converted. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Number
- 101101
- Source base
- 2
- Target base
- 16
- Result
- 2D
Convert Number Base takes an integer written as text, a source base, and a target base, then returns the same integer in the requested numeral system. It supports every base from 2 through 36, so the familiar binary, octal, decimal, and hexadecimal systems work alongside less common compact alphabets. Letters are accepted without regard to case and results use uppercase letters. Before converting, the capability checks every character against the source base and reports invalid input instead of silently producing a misleading value. Its integer arithmetic is exact, deterministic, and suitable for values much longer than ordinary machine integers.
Choose the source base and enter the number
Start by identifying the numeral system in which the original string is written. Binary uses base 2 and therefore permits only zero and one. Octal uses base 8 and permits zero through seven.
Decimal uses base 10, while hexadecimal uses base 16 and adds A through F for values ten through fifteen. The capability extends the same pattern through base 36, where Z represents thirty-five. An optional leading plus or minus sign is allowed, and surrounding whitespace is ignored.
Do not include prefixes such as 0x, 0b, separators, decimal points, commas, or explanatory text; the input represents one whole integer, not a formatted programming-language literal. Letter digits are case-insensitive, so ff and FF mean the same hexadecimal value. Every character is validated before a result is returned.
For example, 102 is rejected in base 2 because the digit two cannot occur there, even though it would be valid in base 3. This strict behavior helps catch a mistaken source base early rather than returning a plausible but incorrect conversion.
Understand how the exact conversion works
A positional numeral is evaluated from left to right. For each digit, the running value is multiplied by the source base and the new digit value is added. This is the same place-value rule taught for decimal numbers, generalized to any radix from two through thirty-six.
After the exact integer value has been recovered, the converter repeatedly divides it by the target base. Each remainder becomes one target digit, and reading those remainders in reverse order produces the final string. The implementation performs those operations with arbitrary-precision integers instead of floating-point numbers, so it does not lose low-order digits when the input exceeds JavaScript's usual safe integer range.
Zero is always returned as 0, including inputs such as -000, because negative zero has no separate integer representation. Leading zeroes are removed naturally from other results, and alphabetic output digits are uppercase for stable comparisons. The algorithm has no network access, random values, clock reads, stored state, or model calls.
Consequently the same fields always yield the same result, making the capability safe for tests, build scripts, data transformations, and reproducible documentation.
Use the result safely in applications
Keep it as text unless you know that the converted value fits exactly in the numeric type used by your application. This matters for long identifiers, bit masks, checksums, database keys, and values handled by languages whose standard number type has a fixed width. A leading minus sign is preserved for nonzero negative integers, while the digits themselves follow the target alphabet 0-9 and A-Z.
Both bases must be integers within the inclusive range from 2 to 36. Handle that error as a validation failure and ask the caller to correct the number or base; do not retry the same request.
What you can do with it
Inspect binary and hexadecimal values
Rewrite bit masks, register values, and protocol fields in the numeral system that makes their structure easiest to review.
Create compact alphanumeric identifiers
Convert a decimal integer to base 36 for a shorter string that still has a simple, reversible numeric meaning.
FAQ
Which bases can I use?
The source and target bases may each be any integer from 2 through 36, inclusive.
Which characters represent digits above nine?
Letters A through Z represent values ten through thirty-five. Input letters are case-insensitive, and output letters are uppercase.
Are negative numbers and leading zeroes supported?
Yes. A leading sign is accepted, leading zeroes do not affect the value, and zero is returned without a negative sign.
Can I paste a value with a prefix like 0x or 0b?
No. Enter only the digits, with an optional plus or minus sign in front. Prefixes, separators, decimal points and commas are refused, while spaces around the number are simply ignored.
How is a number converted from one base to another?
The digits are read from left to right, multiplying the running value by the source base and adding each digit. That value is then divided repeatedly by the target base, and the remainders read in reverse give the result.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/data/base-n-convert \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"number":"101101","source_base":2,"target_base":16}'const res = await fetch("https://api.kit.forhosting.com/data/base-n-convert", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"number": "101101",
"source_base": 2,
"target_base": 16
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/data/base-n-convert",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"number": "101101",
"source_base": 2,
"target_base": 16
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/data/base-n-convert", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"number":"101101","source_base":2,"target_base":16}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"number":"101101","source_base":2,"target_base":16}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/data/base-n-convert", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"number": "101101",
"source_base": 2,
"target_base": 16
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "data.base_n_convert",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_digits | 4096 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Choose the source base and enter the number
Supply the integer in the number field and place its current radix in source_base.
Use the result safely in applications
The successful response contains result as a string rather than a JSON number. A missing field, a base outside that range, a fractional base, an empty number, punctuation inside the digits, or a digit not available in the declared source base produces an invalid_input error. The browser version is useful for individual checks, while the API costs $0.002 per request when conversion is part of an automated workflow.
Integration use cases
Build exact test fixtures
Generate deterministic expected strings for parsers, coding exercises, import validators, and cross-language conversion tests.
Technical questions
What happens when a digit is invalid for the source base?
The request fails with invalid_input and identifies the invalid digit and declared source base.
How much does an API conversion cost?
Each API request uses the published base price of $0.002. The browser tool can be used for individual conversions.