Number base converter
Binary, octal, decimal and hex, both ways. With genuinely large integers: 64-bit values come out exact.
Your figures
Result
- Hexadecimal
- FF
- Octal
- 377
- Binary
- 11111111
- Binary in groups of 4
- 1111 1111
- Bits used
- 8
- Bytes used
- 1
What we assume
- Converted in your browser, with nothing sent anywhere.
- Positive integers only. No decimals and no minus sign, because how those are represented depends on the exact format each language uses.
- The maths uses arbitrary-precision integers, so a 64-bit value comes out exact. With ordinary JavaScript numbers, anything above 2^53 would be rounded.
- The
0xand0bprefixes and grouping spaces are accepted, because that is how the value is written where you copied it from. - Hexadecimal comes back in upper case, without a prefix.
How it is calculated
Changing base does not change the number: it changes how it is written. Plain old 255 is
FF in hex and 11111111 in binary, and all three are worth exactly
the same.
Why hexadecimal and not something else
Because each hex digit is exactly four bits, so a byte is always two digits. That clean correspondence is why colours, memory addresses and hex dumps are written in hexadecimal rather than decimal, where there is no convenient relationship to the bits at all.
The limit that breaks other tools
JavaScript stores numbers as floating point and only guarantees exact integers up to 2^53.
A 64-bit identifier — routine in databases and distributed systems — gets rounded silently.
Here the maths uses arbitrary-precision integers, so FFFFFFFFFFFFFFFF returns all
20 digits exactly.
An example
255 in decimal is FF, 377 and
1111 1111. It takes 8 bits, that is one byte: which is why 255
is the highest value of a colour channel or an unsigned byte.
Frequently asked questions
Can I convert negative numbers?
No, deliberately. A negative in binary depends on the convention — two’s complement, sign and magnitude — and on the word width. Answering without knowing both would be guessing.
What about decimals?
Also no. How a decimal is represented in binary depends on the specific floating-point format, and mixing that with integer conversion only causes confusion.
Why do other sites round my long numbers?
Because they use the ordinary JavaScript number type, which loses precision above 2^53. Here the maths uses arbitrary-precision integers.
Can I paste a value with a 0x prefix?
Yes. Both 0x and 0b are accepted, along with the spaces people use to group bits.
Keep calculating
All tools →- Data size converter Bytes, KB, MB, GB… and KiB, MiB and GiB too. Both systems side by side, which is the only way to see why your 1 TB drive shows 931 GB.
- Unix timestamp converter Timestamp to date and date to timestamp. If the number is in milliseconds we spot it, which is the mistake that wastes the most time.
- HEX, RGB and HSL colour converter Hexadecimal, RGB and HSL, all three ways. Plus the contrast, which is what decides whether readable text fits on top.
Updated on 2026-09-02. Calculations run in your browser; nothing you type is sent to a server.