Development

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, with exact results for huge and negative numbers and a two's complement view.

Number Base Converter
Type a whole number in any field and the others update. Negative numbers, huge numbers, separators and 0x/0b/0o prefixes all work.

3 decimal digits, 8 bits.

Two's complement
The fixed-width bit pattern for this number, and what that pattern means read as signed or unsigned.
Binary
11111111
Hex
ff
As signed int8
-1
As unsigned uint8
255

About this tool

The Number Base Converter turns a whole number into binary, octal, decimal, hexadecimal and any other base from 2 to 36 as you type. Edit any field and the others follow, so you can paste a hex value and read it in binary, or type a decimal and get base 36. Calculations use arbitrary-precision integers, so a 300-digit number converts exactly with no rounding, and negative numbers are supported. Separators are accepted in the input (spaces, underscores, commas) along with 0x, 0b and 0o prefixes, and you can group digits in the output for readability and switch hex to uppercase. For programmers, the two's complement view shows the 8, 16, 32 or 64-bit pattern for a value in binary and hex, and what that pattern means read as a signed or unsigned integer, so you can see why 255 and -1 share the same byte. Everything runs in your browser.

How to use the Number Base Converter

  1. Type a number in any field: binary, octal, decimal, hexadecimal, or the custom base.
  2. The other fields update as you type. Spaces, underscores, commas and 0x/0b/0o prefixes are accepted.
  3. Pick any base from 2 to 36 for the custom field.
  4. Turn on digit grouping or uppercase hex for easier reading, and copy any value.
  5. Choose a width (8, 16, 32 or 64 bits) to see the two's complement pattern and its signed and unsigned meaning.

Use it from your code

The Number Base Converter is also a REST API endpoint. Create a free API key and call it from your own scripts and apps.

curl -X POST https://opentools.ca/api/v1/tools/number-base-converter   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{
    "value": "255",
    "fromBase": 10,
    "toBase": 36,
    "twosComplementBits": 8
  }'

Give us your feedback

Help us improve Number Base Converter!

Frequently asked questions

How big a number can it convert?

Inputs up to 20,000 digits convert exactly. The converter uses JavaScript BigInt, so there is no rounding, unlike calculators limited to 64-bit or floating-point numbers.

Does it handle fractions?

No, only whole numbers. Fractions often have no exact form in another base (0.1 in decimal repeats forever in binary), so they are left out rather than rounded silently.

What is two's complement?

It is how computers store negative integers in a fixed number of bits: the pattern for -x is 2^n minus x. In 8 bits, -1 is 11111111, the same bits as unsigned 255. The view shows any value that fits the chosen width and both ways of reading it.

Which digits are used above base 10?

Letters a to z stand for 10 to 35, so hexadecimal uses 0-9 and a-f, and base 36 uses every digit and letter. Input is not case-sensitive.

Number Base Converter screenshot