Number Base Converter
Convert integers between binary, octal, decimal, and hexadecimal. Supports large numbers via BigInt — all computed locally in your browser.
Input base
Examples:
Binary0b
1111 1111
Octal0o
377
Decimal
255
Hexadecimal0x
FF
Bit length: 8 bitsDecimal value: 255ASCII: 'ÿ'
The four number bases every developer should know
| Base | Name | Digits | Prefix | 255 in this base |
|---|---|---|---|---|
| 2 | Binary | 0, 1 | 0b | 11111111 |
| 8 | Octal | 0–7 | 0o | 377 |
| 10 | Decimal | 0–9 | — | 255 |
| 16 | Hexadecimal | 0–9 A–F | 0x | FF |
Where are these bases used?
- Binary (base 2) — The native language of computers. Every bit is either 0 or 1. Used in bitwise operations, CPU registers, and low-level programming.
- Octal (base 8) — Historically used in Unix/Linux file permissions (e.g.
chmod 755). Each octal digit represents exactly 3 bits. - Decimal (base 10) — The everyday number system. Used for human-readable values, port numbers, and most general-purpose programming.
- Hexadecimal (base 16) — Compact representation of binary data. Used for memory addresses, color codes (
#FF5733), byte values, hashes, and MAC addresses. Each hex digit = 4 bits = 1 nibble.
How to convert between bases
To convert from any base to decimal: multiply each digit by its base raised to the power of its position (right to left, starting at 0), then sum.
Example: binary 1010 = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10.
To convert decimal to another base: repeatedly divide by the target base and collect the remainders in reverse order.
This tool uses JavaScript's BigInt for arbitrary precision, so very large numbers are handled correctly without floating-point errors.