Utilia

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, with two's complement, fractions and step-by-step working.

How to convert a number to another base

  1. Type the value in Number to convert. You can paste it with a prefix (0x, 0b, 0o), with spaces or underscores between digit groups, with a minus sign, and with a fractional part after a point.
  2. Pick the Input base. The four common bases are named; every base from 2 to 36 is available.
  3. Choose an Extra output base if you also need something unusual, such as base 36 for short IDs or base 3 for a puzzle.
  4. The Results table updates as you type. Tick or untick Group digits to add spaces every 4 binary or hex digits and every 3 octal or decimal digits. Each row has its own Copy button, which copies the digits without spaces.

The whole calculation uses JavaScript BigInt, so there is no size limit worth worrying about: a 200-digit decimal number converts exactly, without the rounding you get from ordinary floating-point numbers.

How bases work

In a positional system, each digit is multiplied by a power of the base. In decimal, 255 means 2×10² + 5×10¹ + 5×10⁰. In binary (base 2) the same value is 11111111, in octal (base 8) 377 and in hexadecimal (base 16) FF. Bases above 10 use letters: A = 10, B = 11 … Z = 35, which is why 36 is the largest base with the usual digit set.

Hexadecimal is popular with programmers because one hex digit is exactly four bits: FF is 1111 1111. Octal groups bits by three, which is why Unix permissions such as 755 are written in octal.

Step by step

The Step by step section shows the working, useful for homework and exams:

  • Base N → decimal writes the place values of the integer part, for example 1011₂ = 1×2³ + 1×2¹ + 1×2⁰ = 8 + 2 + 1 = 11.
  • Decimal → binary divides by 2 again and again. The remainders, read from the last one to the first, are the binary digits.
  • For a fractional part, the tool multiplies by 2 repeatedly: each integer part (0 or 1) becomes the next binary digit after the point. 0.625 gives 1.25 → 1, 0.5 → 0, 1.0 → 1, so 0.625 = 0.101₂.

Fractions that never end

Some fractions have no finite form in another base. 0.1 in decimal is 0.0001100110011… in binary, repeating forever; this is why 0.1 + 0.2 is not exactly 0.3 in most programming languages. The tool computes fractions exactly as ratios and stops after Max fraction digits. When it has to cut the result, the row says so, so you always know whether a value is exact.

Two’s complement

Computers store negative integers in two’s complement: for an n-bit integer, −x is stored as 2ⁿ − x. The Two’s complement (signed integers) table shows the bit pattern and hex value for 8, 16, 32 and 64 bits, and how the same pattern reads in the Read as unsigned and Read as signed columns. For example −1 is 11111111 (FF) in 8 bits, and 200 entered as an unsigned byte reads −56 as a signed byte. When a value is outside the range of a width (−128 to 255 for 8 bits), the row says Does not fit.

Frequently asked questions

How do I enter a negative binary number?

Type a minus sign: -1010 in base 2 is −10. If you already have a two’s complement pattern such as 11110110, enter it as a positive binary number and read the Read as signed column for the width you use.

Why are the letters shown in uppercase?

Uppercase A–F is the most common style for hexadecimal. The input accepts both cases; lowercase and uppercase digits mean the same thing.

Can I use a comma as the decimal separator?

Yes. If the number contains no point, a single comma is read as the decimal separator, so 3,75 works like 3.75.

Is there a limit on the size of the number?

The input accepts up to 10,000 characters. The steps are only shown for numbers of up to 64 digits, to keep the page readable.

What does base 36 do?

It uses the digits 0–9 and the letters A–Z, giving the shortest representation with alphanumeric characters. It is often used for compact identifiers and URL shorteners.