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)
0b11111111Octal (base 8)
0o377Decimal (base 10)
255Hexadecimal (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 result
Cite
Cite this page
Reembun. (2026, July 28). Number base converter. https://reembun.com/number-base-converter
How to use it
Enter the value
Type the number, then set Input base to say what it already is.
Read every base at once
Binary, octal, decimal and hexadecimal are shown together, so there is no chain of conversions to get wrong.
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.
Copy the form you need
Each base has its own copy button.
The four bases
| Base | Name | Digits | Prefix |
|---|---|---|---|
| 2 | Binary | 0-1 | 0b |
| 8 | Octal | 0-7 | 0o |
| 10 | Decimal | 0-9 | none |
| 16 | Hexadecimal | 0-9, A-F | 0x |
A worked example
The decimal number 255:
| Base | Value |
|---|---|
| Binary | 0b11111111 |
| Octal | 0o377 |
| Decimal | 255 |
| Hexadecimal | 0xFF |
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:
| Hex | Binary |
|---|---|
| 0 | 0000 |
| 7 | 0111 |
| A | 1010 |
| F | 1111 |
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
| Bits | Unsigned maximum |
|---|---|
| 8 | 255 |
| 16 | 65,535 |
| 32 | 4,294,967,295 |
| 53 | 9,007,199,254,740,991 |
| 64 | 18,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
