Binary / Hex / Octal Converter
Convert any number between binary, decimal, octal, and hexadecimal.
Type a number in any base — binary, decimal, octal, or hexadecimal — and see it converted into the other three instantly. Built for students, programmers, and anyone working with number systems.
Quick reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
How number bases work
A number base is how many different digits a system uses. Decimal (base 10) uses 0–9. Binary (base 2) uses only 0 and 1. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 plus A–F, where A = 10 and F = 15.
Each position is worth the base raised to a power. In decimal, 156 means 1 × 100 + 5 × 10 + 6 × 1. In binary, 10011100 means 128 + 16 + 8 + 4 = 156.
Converting by hand: decimal to binary
Divide by 2 repeatedly and write down the remainders, then read them from bottom to top. For 156:
| Divide | Result | Remainder |
|---|---|---|
| 156 ÷ 2 | 78 | 0 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading the remainders upward gives 10011100. The same method works for any base — divide by 8 for octal (156 = 234) or by 16 for hex (156 = 9C).
Where you'll see these bases
- Hex color codes: the web color #FF8800 is red FF = 255, green 88 = 136 and blue 00 = 0 — a bright orange.
- File permissions: on Linux and macOS, chmod 755 is octal for "owner can read, write and run; everyone else can read and run".
- Computer memory: 8 binary digits make a byte, which holds 0–255 (00–FF in hex). Memory addresses and error codes are usually shown in hex.
- Networking: MAC addresses and IPv6 addresses are written in hex.
Frequently asked questions
What bases does this support?
Binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) — type into any one and the other three update instantly.
Can I convert negative numbers?
This converter works with non-negative whole numbers. For negative or fractional values, most programming languages use two's complement or floating-point representations, which are outside the scope of a simple base converter.
Is there a limit to how large a number I can convert?
No practical limit — the converter uses arbitrary-precision arithmetic, so it handles numbers far larger than a standard 32- or 64-bit integer.
Why do programmers use hexadecimal?
One hex digit stands for exactly four binary digits, so hex is a compact way to write binary. The byte 11111111 is simply FF in hex.