ForHosting KIT · Developer Utilities

Convert number between bases 2–36 with digit validation

The hexadecimal number -deadBEEF becomes -1PS9WXB in base 36. Enter a whole number, say which base it is written in and pick any target base from 2 to 36; long numbers stay exact, with no rounding. 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
Number
-deadBEEF
Source base
16
Target base
36
You get
Result
-1PS9WXB

Convert Number Between Bases rewrites a whole number from one positional numeral system into another without changing its value. Enter the number as text, identify its source base, and choose a target base anywhere from 2 through 36. The converter validates every digit before doing the calculation, accepts upper- or lowercase letters, preserves a meaningful negative sign, and returns a canonical uppercase result. Arbitrary-precision integer arithmetic keeps long inputs exact instead of rounding them to the limits of an ordinary JavaScript number. The operation is deterministic, uses no network service, and reports malformed numbers or unsupported bases as input errors.

Describe the original number accurately

Begin with the base in which the supplied number is already written. A base determines both the available digit symbols and the place value assigned to each position. Base 2 accepts only 0 and 1; base 8 accepts 0 through 7; base 10 accepts 0 through 9; and base 16 extends the digits with A through F.

The same convention continues through base 36, where Z has the value thirty-five. The number may have surrounding whitespace and one leading plus or minus sign, but its body must contain at least one digit. Do not add programming prefixes such as 0x or 0b, digit separators, commas, decimal points, exponents, or units.

Those characters are not part of this whole-number alphabet and are rejected. Letters are case-insensitive on input, so hexadecimal ff and FF denote the same value. Validation is deliberately tied to the declared source base: a character can belong to the general alphabet yet still be illegal in a particular radix.

For example, 19 is valid in decimal but invalid in octal because octal has no digit whose value is nine.

Follow the exact conversion process

The converter first evaluates the source string with the ordinary positional rule. Moving from left to right, it multiplies the accumulated value by the source base and adds the value of the next digit. This method works uniformly for binary, decimal, hexadecimal, and every supported radix between them.

Once the exact integer has been recovered, the converter expresses its magnitude in the target base by repeated division. Each division produces a remainder, that remainder selects one target digit, and reversing the collected remainders gives the finished representation. The implementation uses arbitrary-precision integers throughout this work.

It therefore avoids the rounding that can occur when a long identifier or bit pattern is passed through a floating-point number beyond its safe range. Output letters are always uppercase, unnecessary leading zeroes disappear, and any representation of zero becomes exactly 0. A minus sign is restored only when the mathematical value is nonzero, so an input such as -000 does not create a separate negative-zero result.

There are no random choices, time-dependent values, locale rules, stored state, remote requests, or model calls. Given the same three fields, the returned string is reproducible byte for byte.

Review low-level values

Move register contents, bit masks, file permissions, and protocol fields between binary, octal, decimal, and hexadecimal views.

Shorten numeric identifiers

Express a long decimal identifier in base 36 as a compact alphanumeric string while keeping the conversion reversible.

Which source and target bases are supported?

Each base must be an integer from 2 through 36, inclusive.

How are digit values above nine written?

Letters A through Z represent values ten through thirty-five. Input is case-insensitive, while output uses uppercase letters.

Can the converter handle negative or very long integers?

Yes. One leading sign is accepted, and arbitrary-precision arithmetic keeps inputs of up to 4,096 digits exact.

Can I type a prefix like 0x or 0b?

No. Choose the source base instead and enter only the digits. Prefixes, commas, spaces between digits and decimal points are not part of the number and are rejected rather than guessed.

Why is my number rejected in base 8?

Every digit must be smaller than the base. 19 is fine in decimal but not in octal, because octal has no digit with the value nine. Check that the source base matches how the number was written.

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/dev2/base-convert-number

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/dev2/base-convert-number \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"number":"101101","source_base":2,"target_base":16}'
{
  "number": "101101",
  "source_base": 2,
  "target_base": 16
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev2.base_convert_number",
  "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_digits4096
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.

Describe the original number accurately

Put the original representation in the number field and its radix in source_base.

Validate and use the returned string safely

Keeping the result as text is important because its digits may include letters and because very large integers cannot necessarily be represented exactly by the numeric type in the calling language. Treat that response as a request validation problem: correct the indicated field rather than retrying identical data. Inputs are bounded to 4,096 digits so computation and memory remain predictable. When checking a conversion, a useful independent test is to convert the result back by swapping the bases; the canonical digits may differ in leading zeroes or letter case, but the mathematical value should match. A successful response contains result as a string. Both source_base and target_base must be integers within the inclusive range from 2 to 36. A missing base, a fractional base, an out-of-range base, a non-string number, an empty body, punctuation among the digits, or a digit whose value reaches or exceeds the source base causes an invalid_input response. Individual conversions can run in the browser, while automated API requests use the published price of $0.002 per request.

Create deterministic fixtures

Produce exact expected strings for parsers, coding exercises, migration checks, and cross-language regression tests.

What happens when a digit does not belong to the source base?

The request fails with invalid_input and identifies the offending digit and source base.

What does an API conversion cost?

The API price is $0.002 per request. Individual conversions can also run in the browser.

Read the full KIT documentation →