Skip to content
Reembun
Base converter icon
Developer

Number base converter

Convert between binary, octal, decimal and hexadecimal using arbitrary-precision arithmetic, so 64-bit values stay exact.

Prefixes like 0x, 0b and 0o are accepted and ignored, as are underscores and spaces used as digit separators.


Binary (base 2)

0b11111111

Octal (base 8)

0o377

Decimal (base 10)

255

Hexadecimal (base 16)

0xFF

Bit length
8
Fits in
8-bit
Exact in JS Number
Yes

Binary, grouped in fours

1111 1111

Ready. Runs locally on your device.

Your files stay on your device. The tool works directly in your browser, using your device to process your files. Nothing is sent to our servers, and we never receive, store, or see your files or figures.

Share

Share this page

Share result

Your results

Use the tool above first. Whatever it works out shows up here, ready to copy or share.

Cite

Cite this page

Reembun. (2026, July 28). Number base converter. https://reembun.com/number-base-converter
Pick a style, then copy the reference. The access date is today.

How to use it

  1. Enter the value

    Type the number, then set Input base to say what it already is.

  2. Read every base at once

    Binary, octal, decimal and hexadecimal are shown together, so there is no chain of conversions to get wrong.

  3. Check the size

    Bit length, what it fits in and whether it is still exact in a JavaScript number are shown underneath, which matters once a value passes 32 bits.

  4. Copy the form you need

    Each base has its own copy button.

The four bases

BaseNameDigitsPrefix
2Binary0-10b
8Octal0-70o
10Decimal0-9none
16Hexadecimal0-9, A-F0x

A worked example

The decimal number 255:

BaseValue
Binary0b11111111
Octal0o377
Decimal255
Hexadecimal0xFF

255 is the largest value an unsigned byte holds, which is why FF appears everywhere from colour codes to network masks.

Why hexadecimal, not decimal

Because 16 is a power of 2, each hex digit maps to exactly four bits:

HexBinary
00000
70111
A1010
F1111

So one byte is always exactly two hex digits, and a 32-bit value is always exactly eight. Decimal has no such alignment: 255 is three digits and 256 is three digits, but they are 8 and 9 bits respectively.

This is why hex dominates anywhere bits matter: memory addresses, colour codes, MAC addresses, hashes, permission masks and file signatures.

The precision problem

JavaScript’s Number is a double-precision float. It represents integers exactly only up to 253 − 1, or 9,007,199,254,740,991.

parseInt("9007199254740993")  →  9007199254740992   ← wrong

That is a silent, off-by-one corruption of a 64-bit identifier. Snowflake IDs from X, Discord IDs, database bigints and most 64-bit hashes all live above the threshold.

This converter uses BigInt, which is arbitrary precision, so the digits it shows are exact regardless of size. If you are working with values this large in code, they must be transmitted as strings in JSON and handled as BigInt in JavaScript, because a plain JSON.parse will round them.

Bit widths

BitsUnsigned maximum
8255
1665,535
324,294,967,295
539,007,199,254,740,991
6418,446,744,073,709,551,615

The 53-bit row is not a hardware boundary. It is the JavaScript one, and it is the one that catches people out.

Where each base shows up

Binary: permission bits, feature flags, protocol headers, bitwise masks.

Octal: Unix file permissions. chmod 755 is three octal digits, each encoding three permission bits, which is why the digits never exceed 7.

Hexadecimal: colours, memory addresses, hashes, MAC addresses, Unicode code points, file magic numbers.

Decimal: everything a human has to read aloud.

Common questions

Why does this use BigInt?

Because JavaScript's Number type holds integers exactly only up to 2^53 − 1. Any 64-bit identifier, bitmask or hash converted through parseInt will silently round, which is exactly the kind of value people reach for a base converter to inspect. BigInt has no such limit.

What do the prefixes mean?

0b marks binary, 0o octal and 0x hexadecimal, following the convention in C, Python, JavaScript and most modern languages. They are accepted and ignored on input, and shown on output so the result can be pasted straight into code.

Why group binary in fours?

Because each group of four bits is exactly one hexadecimal digit, so grouped binary can be read against a hex value directly. It is also how register maps and protocol specifications are conventionally printed.

Why is hexadecimal used so widely?

Because 16 is a power of 2, so each hex digit maps to exactly four bits with no remainder. That makes hex a compact, lossless shorthand for binary: one byte is always exactly two hex digits, which decimal cannot offer.

Last reviewed