🔢 Number Base Converter
Convert a number between binary, octal, decimal, hexadecimal or any base from 2 to 36. Arbitrary-precision arithmetic means very large values convert exactly, with no floating-point rounding.
0x for hex,
0b for binary and 0o for octal. Underscores and spaces are ignored,
so 1010_1010 works fine.
How a value is read and rewritten
Each digit is looked up in the alphabet 0-9 then a-z
and folded into a running total, most significant digit first:
value = value x base + digit digits: 0-9 a-z, so base 2 to 36
Enter 255 in decimal and it comes back as FF in hex, 377 in octal and 11111111 in binary - 8 bits, 1 byte. The running total is a BigInt, not a normal JavaScript number, so precision does not stop at 9007199254740991. A 40-digit hex value converts to decimal exactly, digit for digit.
What the input accepts
- Prefixes win over the dropdown. Typing
0xFF,0b1010or0o755switches the From base for you. - Case does not matter going in; results always come back uppercase, so hex reads DEADBEEF.
- Underscores and spaces are stripped, which lets you paste
1010_1010or a spaced-out register dump unchanged. - A leading minus is kept and reapplied to every output.
Frequently asked questions
What is 255 in binary?
11111111 - eight ones. It is the largest value a single byte holds, which is why 255 turns up as the maximum in colour codes and IP address octets.
What do the bits and bytes figures mean?
Bits is the length of the binary form, so it is the smallest number of bits that can hold the value. Bytes rounds that up to whole 8-bit groups: 255 needs 8 bits and 1 byte, 256 needs 9 bits and 2 bytes.
Why does base 36 exist?
It is the highest base the ten digits plus 26 letters can write without new symbols, which makes it the most compact way to encode an integer as plain text - short URL identifiers are the usual use.