GALAXY OF TOOLS

DEV SECTOR

Number Base Converter

Convert between binary, octal, decimal, hex and any base 2–36 — big numbers, negatives and fractions too.

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Convert numbers between binary, octal, decimal and hex

This number base converter shows a number in binary, octal, decimal, hexadecimal and any custom base from 2 to 36 at the same time. Type into whichever box you like — the others update as you type — so converting hex to decimal, decimal to binary or binary to hex is a single step instead of a chain of separate tools.

It uses JavaScript’s arbitrary-precision BigInt, so 64-bit IDs, 128-bit values and numbers hundreds of digits long convert exactly, with no rounding. Negative numbers, fractional parts and a two’s complement view for 8- to 128-bit integers are built in, which makes it useful for programmers, students of computer science and electronics, and anyone decoding values from logs, registers or network packets.

How to use the Number Base Converter

  1. Type a number into any box: Decimal, Hexadecimal, Octal, Binary or Custom base. Prefixes such as 0x, 0b and 0o are accepted.
  2. For an unusual radix, pick it from the “Custom base” list (base 2 to base 36) and type or read the value there.
  3. Tick “Group digits” to split long results into readable blocks, and choose how many fraction digits to show.
  4. To see how a signed integer is stored, choose a size under “Two’s complement”; you can also type a bit pattern there to decode it.
  5. Use the copy button beside any box to copy that result.

Number Base Converter features

Edit any field

Every base is both input and output, so there is no “from” and “to” to set up.

Exact big numbers

BigInt arithmetic converts integers of any length without the precision loss that affects ordinary floating-point numbers above 253.

Negatives and fractions

A leading minus sign works in every base, and fractional parts are converted exactly; repeating results are cut at your chosen length and marked with “…”.

Two’s complement

See the 8, 16, 32, 64 or 128-bit pattern of a signed value, its signed and unsigned readings, and decode a pattern back to a number.

Clear validation

A digit that does not exist in a base — such as 8 in octal or G in hex — is named in a specific error message.

How base conversion works

In a positional number system each digit is multiplied by a power of the base. The binary number 10011100 is 1×128 + 0×64 + 0×32 + 1×16 + 1×8 + 1×4 + 0×2 + 0×1 = 156 in decimal. To go the other way, divide by the target base repeatedly and read the remainders from last to first: 156 ÷ 16 = 9 remainder 12 (C), so 156 is 9C in hexadecimal.

Hexadecimal and octal are popular with programmers because they map neatly onto binary: one hex digit is exactly four bits and one octal digit is exactly three. That is why colours are written as #FF8800 (see the color converter) and Unix permissions as 755 (see the chmod calculator). Bases above 10 use letters for the extra digits: A = 10, B = 11 … Z = 35, which is why base 36 is the highest standard radix.

DecimalBinaryOctalHex
0000
1111
21022
711177
81000108
10101012A
15111117F
16100002010
100110010014464
25511111111377FF

Two’s complement and negative numbers

Computers store signed integers in two’s complement: to negate a number, invert every bit and add one. In 8 bits, 1 is 00000001, so −1 is 11111110 + 1 = 11111111. The highest bit therefore acts as the sign, and an 8-bit signed value ranges from −128 to 127, while the same eight bits read as unsigned range from 0 to 255. The converter shows both readings, so you can see why a byte of 0xC8 means 200 to one program and −56 to another.

Outside a fixed width, this tool writes negative numbers with a minus sign, the mathematical convention, for example −FF in hex.

Fractions and why 0.1 never ends in binary

A fraction terminates in a base only if its denominator’s prime factors all divide that base. One tenth has the factor 5, which 2 does not have, so 0.1 in binary is the endless pattern 0.000110011001100… — the root of familiar floating-point surprises such as 0.1 + 0.2 ≠ 0.3. Results like this are cut at the number of fraction digits you choose and end in “…”, while values such as 10.625 convert exactly (1010.101 in binary).

To turn text rather than numbers into binary or hex, use the text to binary converter.

Number Base Converter FAQ

How do I convert binary to decimal?

Multiply each bit by its place value (1, 2, 4, 8, 16 …, starting from the right) and add the results: 1101 = 8 + 4 + 0 + 1 = 13. Or type the binary number into the Binary box of this number base converter and read the Decimal box.

How do I convert decimal to hexadecimal?

Divide by 16 repeatedly and write the remainders backwards, using A–F for 10–15. For 3000: 3000 ÷ 16 = 187 r 8, 187 ÷ 16 = 11 r 11 (B), 11 ÷ 16 = 0 r 11 (B), so 3000 = BB8 in hex.

Is there a limit to how big the number can be?

Only practical ones: the converter accepts up to 20,000 digits and converts integers exactly using BigInt. Ordinary JavaScript numbers lose precision after 9,007,199,254,740,991 (253 − 1), but this tool does not use them for conversion.

What is base 36 used for?

Base 36 uses all ten digits and 26 letters, giving the shortest case-insensitive way to write a number with plain alphanumeric characters. It is common for short URLs, compact IDs and reference codes.

Why does my negative hex number show a minus sign instead of FF…?

Without a fixed width there is no single bit pattern for a negative number, so the converter uses a minus sign. Choose 8, 16, 32, 64 or 128 bits under “Two’s complement” to see the stored pattern, such as FFFFFFFF for −1 in 32 bits.

Can I convert numbers with a decimal point?

Yes. Type a value such as 10.625 or 0.1 in any base. The fraction is converted exactly; if it repeats forever in the target base, the result is cut at your chosen number of fraction digits and ends with “…”.

You might also need