Skip to content

Number base converter

Convert between decimal, binary, octal and hexadecimal.

Runs in your browser — nothing is sent anywhere.

All four bases at once

Enter a number and get decimal, binary, octal and hexadecimal together, plus the bit length. Prefixes are understood — 0x for hex, 0b for binary, 0o for octal — or you can set the input base explicitly when the value is ambiguous.

Where each base turns up

Hexadecimal is everywhere in programming because one hex digit is exactly four bits, so a byte is always two digits. Colours, memory addresses, hashes and byte dumps all use it.

Binary is what the machine actually does. It matters when you are working with flags and bitmasks, where each bit is an independent switch — and the bit count shown here tells you whether a value fits the type you are storing it in.

Octal survives almost entirely in Unix file permissions, where 755 is three groups of three bits: read, write and execute for owner, group and others.

Big numbers are handled properly

JavaScript's ordinary numbers lose precision above 2⁵³, which is why so many online converters silently return the wrong digits for large hashes and 64-bit IDs. This uses arbitrary-precision integers instead, so a 64-bit value converts exactly.

That is worth checking in any converter you use: enter 9007199254740993 and see whether it comes back unchanged.

The character view

Where a value falls in the Unicode range, the corresponding character is shown. Handy when reading an escape sequence — 0x41 is A, and 0x1F600 is a grinning face.

Nothing is uploaded

Everything runs in your browser.

01

Common questions

How do I enter hex?

Prefix with 0x, or set the input base to 16. Binary uses 0b, octal 0o.

Does it handle very large numbers?

Yes, using arbitrary-precision integers. Many converters silently lose precision above 2^53.

Why is hex used so much?

One hex digit is exactly four bits, so a byte is always two digits — much easier to read than eight binary digits.

What is octal for?

Almost entirely Unix file permissions, where 755 encodes three sets of three bits.

What does the bit count mean?

How many binary digits the value needs — which tells you whether it fits in the type you are storing it in.