Skip to content

🔢 Number Base Converter

Instantly convert binary, octal, decimal, and hexadecimal numbers. Supports 0x / 0b / 0o prefixes, bit-length, and signed two's complement.

100% Free No signup Browser-only 5 languages Dark mode

Bit representation

8-bit signed
8-bit unsigned
16-bit signed
16-bit unsigned
32-bit signed
32-bit unsigned

🔗 Related Tools

📖 Where people get stuck

Convert between base 2, 8, 10 and 16, with 0x, 0b and 0o prefixes recognised automatically. In practice you need a base conversion for one of four things — permissions, bit flags, colour codes, or character codes — and the digits mean something different in each. A numerically correct conversion is still useless if the interpretation is wrong.

Case What happens What to do
Treating a permission like 755 as decimal The 755 in chmod 755 is octal, and is not the decimal 755 (which would be 1363 in octal). Each of the three digits covers owner, group and others, and each is the sum of read=4, write=2, execute=1. So 755 is 111 101 101: everything for the owner, read and execute for everyone else. Type it as 0o755 and it is read as octal. The same trap exists in code: Python os.chmod(path, 755) passes decimal 755 and sets permissions nothing like what you meant. Always write 0o755.
Negative numbers and bit operations disagree Computers represent negatives in two complement form. Minus one is 11111111 (0xFF) in eight bits and 0xFFFFFFFF in thirty-two, so the representation depends entirely on the width you are viewing. A plain base conversion writes a minus sign followed by the magnitude, which will never match a memory dump or a register value. Decide the bit width first — until you know whether you are looking at 8, 16, 32 or 64 bits, there is no single right answer. Note that every bitwise operation in JavaScript truncates to a signed 32-bit integer, so 1 << 31 is -2147483648, not the positive 2147483648. Use BigInt when you need 64 bits.
Adding hex colour codes as numbers #FF8800 is not one number but three independent bytes: R, G and B. Treat it as decimal 16746496 and add to brighten it, and the carry spills into the neighbouring channel and changes the hue — you meant to add green and the overflow lands in red. Split into channels, do the arithmetic per channel, clamp each to 0–255, then recombine. If all you want is lighter or more saturated, converting to HSL and moving L or S is far more direct. The colour converter moves between HEX, RGB and HSL.

Hexadecimal is everywhere because one digit maps exactly to four bits. A byte is always two digits, so memory contents, colours and character codes all line up in neat columns. Octal survives in Unix permissions for the same reason: group the bits in threes and read, write and execute fit in exactly one digit. Decimal, not being a power of two, fits poorly with anything bitwise — the boundaries never land on round numbers.

📖 How to Use

  1. 1
    Enter a number in any field
    Enter a number in any of the DEC, HEX, BIN, or OCT fields. Prefixes 0x, 0b, and 0o are supported.
  2. 2
    See instant conversion in other bases
    The other three representations update automatically as you type.
  3. 3
    Check bit representation
    The bit panel below shows 8/16/32-bit signed and unsigned twos-complement representations.

❓ Frequently Asked Questions

Can I enter negative numbers?
Yes. Enter a negative number in the decimal field with a minus sign. The bit panel shows the twos-complement representation.
Can it handle very large numbers?
Yes — the tool uses JavaScript BigInt, so it handles arbitrary-precision integers.
Can I use separators like commas or underscores?
Yes. Commas, underscores, and spaces are automatically stripped before parsing.
🐛 Found a bug or issue with this tool?

Free to use, no signup. Even just the steps to reproduce are helpful. Reports go directly to the operator and help us fix issues.

* Browser info (UA / screen / language / URL) is sent automatically to help reproduce the issue