ForHosting KIT · Developer Utilities

Base converter

Rewrite a number from one base into another, anywhere from base 2 to base 36: 1010 in binary is 10 in decimal. Big values stay exact to the last digit, and a leading minus sign is kept. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Value
1010
From base
2
To base
10
You get
Result
10

Converts a string of digits from one radix to another between base 2 and base 36 using arbitrary-precision big integers, preserving an optional leading minus sign.

What changing base really means

A base says how many different digits a number system uses before it carries over to a new position. Decimal uses ten, binary uses two, hexadecimal uses sixteen and base 36 uses the ten digits plus all twenty-six letters. The quantity itself never changes; only the way it is written does. So 1010 in binary and 10 in decimal are the same amount. The converter reads your digits in the source base, works out the whole number they stand for, and then writes that number again in the target base. That is why binary to hexadecimal, hexadecimal to decimal and decimal to base 36 all use the same steps.

Mistakes this converter avoids

Many everyday tools quietly lose precision once a number goes beyond 2^53, so the last digits of a long identifier or hash come back wrong. Here every value is handled as an exact whole number, up to 200 characters, so nothing gets rounded. A digit that does not exist in the source base, like a 2 in binary or a G in hexadecimal, is reported instead of being ignored. Prefixes such as 0x are not accepted, so the base is always the one you chose. Only whole numbers are supported: a decimal point or a fraction will not convert.

The same exact answer every time

Because arithmetic runs on BigInt, there is no silent precision loss the way parseInt and Number.toString(radix) can suffer near and beyond 2^53, which makes this safe for large hashes, identifiers, colour values or bit masks. Common uses include binary-to-hex and hex-to-decimal conversions, encoding IDs into a compact base-36 alphabet, and inspecting how a number looks across radices.

Developer number inspection

Convert between binary, octal, decimal and hexadecimal while debugging bit masks, flags or colour values.

Compact base-36 IDs

Encode large decimal identifiers into a shorter base-36 string, or decode them back exactly with big integers.

Does it handle very large numbers?

Yes. Values are parsed as BigInt, so conversion is exact with no floating-point loss even beyond 2^53.

Are negative numbers and letters allowed?

A leading minus is preserved, letters A-Z serve as digits above 9, and input is uppercased so 'ff' equals 'FF'.

How do I convert binary to hexadecimal?

Choose 2 as the source base and 16 as the target base, then type the binary digits. The same steps work for any pair of bases between 2 and 36, such as hexadecimal to decimal.

Can I type 0x or 0b in front of the number?

No. Those prefixes are rejected because the base is chosen separately, not guessed from the number. Remove the 0x or 0b and pick base 16 or base 2 instead.

Which digits does base 36 use?

The digits 0 to 9 followed by the letters A to Z, so base 16 stops at F and base 36 uses the whole alphabet. Lowercase and uppercase letters count as the same digit.

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.

POSThttps://api.kit.forhosting.com/dev/number-base

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.

curl -X POST https://api.kit.forhosting.com/dev/number-base \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":"FF","from_base":16,"to_base":10}'
{
  "value": "FF",
  "from_base": 16,
  "to_base": 10
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.number_base",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_value_chars200
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Radix conversion with big integers

Because the value is held as a BigInt rather than a JavaScript number, conversions are exact for arbitrarily large magnitudes with no floating-point loss. dev.number_base parses value as a string of digits in from_base, accumulates it into a BigInt, then re-encodes that integer in to_base. Both from_base and to_base are integers in the range 2 to 36; digits use 0-9 followed by A-Z, so base 16 uses 0-F and base 36 uses the full alphabet. Input is uppercased before parsing, so hexadecimal 'ff' and 'FF' are equivalent, and each character is checked to be a valid digit strictly below from_base — anything else returns a typed invalid_input error. The response returns the original value, from_base, to_base and the encoded result string, so the binary example '1010' from base 2 to base 10 returns '10'.

Accepted input and strict rules

value must be a non-empty string no longer than 200 characters, and the encoded result is likewise capped at 200 characters. A single leading minus sign is allowed and preserved through the round trip, so negative numbers convert correctly, but base prefixes are explicitly rejected: any value starting with 0x, 0X, 0b or 0B returns invalid_input, because the base is given by from_base, not inferred from a prefix. There is no fractional or decimal-point support — only integers. from_base and to_base must both be integers within 2 to 36; a value out of that window, a digit that is not legal for the source base, an empty or over-long string, or a bare minus sign all raise a typed invalid_input error with a message naming the fault, so callers can catch and surface it cleanly.

Batch radix conversion

Call the API over a column of values to convert an entire dataset between two bases in one job.

Which bases are supported?

Any integer radix from 2 to 36 for both from_base and to_base, using digits 0-9 then A-Z.

Can I use 0x or 0b prefixes?

No. Prefixed values are rejected with invalid_input; the radix comes from from_base, not from a prefix.

What are the limits and cost?

value and result are each capped at 200 characters; the browser widget is free and the API bills only successful tasks at $0.002.

Read the full KIT documentation →