How to use the Number Base Converter
- 1
Type a number into any field, Binary, Octal, Decimal, Hexadecimal or the custom base, and the other fields update as you type.
- 2
Paste values with 0b, 0o or 0x prefixes, underscores or spaces between digits; they are understood. An invalid digit is highlighted with its position.
- 3
Turn on Signed and choose a width from 8 to 128 bits to see negative numbers as two's complement, or to read a hex pattern such as FF as -1.
- 4
Click bits in the bit grid to flip them and watch every base change.
- 5
Switch Group, Uppercase and Prefixes to match the style you need, then copy a field or press Copy link to share the number.
Features
- Binary, octal, decimal, hexadecimal and any base from 2 to 36, all editable and kept in sync
- Exact for numbers of any size using arbitrary-precision integers
- Two's complement at 8, 16, 32, 64 and 128 bits for signed values and bit patterns
- Clickable bit grid of up to 64 bits with bit numbers and the sign bit marked
- Exact fractions with repeating digits shown in parentheses, such as 0.1 as 0.0(0011)
- Accepts prefixes, underscores and spaces, and pinpoints invalid digits
- Digit grouping, uppercase hex and 0b, 0o and 0x prefixes on output
- Bit length, byte length and the range of the chosen width
Bases in everyday programming
Computers store everything in binary, but people read decimal, and programmers read hexadecimal because each hex digit maps to exactly four bits. Octal survives in Unix file permissions. Converting between them comes up constantly: reading a memory address, decoding a flags field, checking a colour channel, or working out why a bitmask does not match. This converter keeps all the bases side by side, so you can type in whichever one you have.
Values are held exactly with arbitrary-precision integers, so there is no rounding at 2 to the power 53 as there is with ordinary JavaScript numbers. A 256-bit hash in hex converts to decimal and back without losing a digit.
Signed numbers and bits
Turn on Signed to work with two’s complement, the representation almost every processor uses for negative integers. The width matters: FF is -1 as a signed 8-bit value but 255 as a 16-bit one. The bit grid shows the pattern for the chosen width with the sign bit first, and clicking a bit flips it, which is a fast way to build or check a bitmask.
Fractions are exact too. Type 0.1 in the decimal field and the binary field shows 0.0(0011), with the repeating block in parentheses. That one line explains most floating-point surprises.
Related tasks
To turn text into bytes in binary or hex, use Text to Binary. For colours written as hex codes, the Color Converter converts them to RGB, HSL and OKLCH.
Frequently asked questions
How do I convert decimal to binary?
What is two's complement?
Why does 0.1 become a repeating binary number?
Which bases are supported?
Can I paste numbers with prefixes or separators?
Is anything uploaded?
Last updated .