Number Base Converter
Type a number and choose its base to see it in binary, octal, decimal and hexadecimal at once, plus any base from 2 to 36. 255 is 11111111 in binary and FF in hex. Numbers of any size convert exactly, prefixes such as 0x and 0b are accepted, and negative numbers show their two's complement. It runs in your browser.
Updated
How to use the Number Base Converter
- 1Type the number. Spaces, underscores and a 0x, 0b or 0o prefix are fine.
- 2Choose the base it is written in.
- 3Read the binary, octal, decimal and hexadecimal values, or set a custom base.
- 4Copy any result; copied binary, octal and hex include their prefix.
How it works
A number in base b is read digit by digit: each step multiplies the running total by b and adds the next digit. Digits beyond 9 are the letters a to z, so hexadecimal uses 0–9 and A–F, and base 36 uses every letter.
The arithmetic uses JavaScript's BigInt, so there is no size limit and no rounding. Ordinary JavaScript numbers lose precision above 2⁵³ (about 9 × 10¹⁵), which is why some converters give wrong answers for long binary or hex values.
Digits are grouped in fours for binary and hex (one hex digit is exactly four bits) and in threes for decimal and octal, purely for readability; copying gives the plain digits.
Negative numbers are shown with a minus sign and, below, as the two's complement bit pattern computers use to store signed integers in 8, 16, 32 and 64 bits — for example −1 is 11111111 in 8 bits.
Worked example
Converting 255 from decimal
- Binary: 255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 → 11111111
- Octal: 255 = 3 × 64 + 7 × 8 + 7 → 377
- Hex: 255 = 15 × 16 + 15 → FF
Result: 11111111 (binary), 377 (octal), FF (hex).
Tips and common mistakes
- Use hex to read binary quickly: each hex digit is exactly four bits.
- Check colour codes such as #FF8800 by converting each pair of hex digits to decimal.
- For file permissions on Unix, octal 755 is binary 111 101 101.
- Watch the input base: 10 means ten in decimal but two in binary.