Quick Answer
To convert decimal to binary, repeatedly divide by 2 and read the remainders bottom-up; to go back, add powers of 2. For example, 255 in decimal is 11111111 in binary, 377 in octal and FF in hexadecimal. The converter shows every base at once, exactly, for any size of number.
Number Base Converter: Binary, Octal, Decimal and Hexadecimal in One Place
Computers store everything in binary, people count in decimal, and programmers spend much of their day in hexadecimal. Moving between these number systems is routine for students of computer science and electronics, for developers reading memory addresses, colour codes and bit masks, and for anyone preparing for exams with number-system questions. This free number base converter does the conversion instantly and exactly. Type a number, tell it which base it is in, and it shows the same value in binary, octal, decimal, hexadecimal, base 32 and base 36 all at once.
Unlike calculators that quietly lose precision once numbers get big, this tool uses exact big-integer arithmetic. A 64-bit value, a 128-bit hash or a 300-digit number converts without a single wrong digit. It also understands the prefixes programmers type — 0x, 0b, 0o — ignores spaces and underscores, and tells you exactly which character is invalid if you make a typo. Everything runs in your browser.
How to Use the Converter
- Type your number in the Number box. You can write
255,0xFF,0b1111_1111or1111 1111. - Choose the base it is written in — Decimal, Binary, Octal, Hexadecimal, or Other base… for anything from 2 to 36.
- Read the results. The table shows binary, octal, decimal, hexadecimal, base 32 and base 36. The line above it confirms how the input was read and how many bits the number needs.
- Adjust the display. Turn digit grouping on or off (binary in fours, octal in threes, hex in pairs, decimal with commas), and choose uppercase or lowercase letters.
- Copy All puts every conversion on your clipboard, one per line.
How Number Bases Work
A number base, or radix, is how many different digits a positional system uses. In base 10 we have ten digits, 0 to 9, and each position is worth ten times the one to its right: units, tens, hundreds. In base 2 there are only two digits, 0 and 1, and each position is worth twice the previous one: 1, 2, 4, 8, 16 and so on. Hexadecimal uses sixteen digits — 0 to 9 and then A to F for ten to fifteen — so positions are worth 1, 16, 256, 4,096.
The value of any number is the sum of each digit times its place value:
value = dₙ × bⁿ + … + d₂ × b² + d₁ × b + d₀
The converter reads your input this way into an exact integer, then writes that integer out in each target base by repeated division.
Worked Examples
Decimal to binary: 13
Divide by 2 and note the remainders: 13 ÷ 2 = 6 remainder 1; 6 ÷ 2 = 3 r 0; 3 ÷ 2 = 1 r 1; 1 ÷ 2 = 0 r 1. Reading the remainders from bottom to top gives 1101.
Binary to decimal: 1101
1 × 8 + 1 × 4 + 0 × 2 + 1 × 1 = 13.
Hex to decimal: 7EA
7 × 256 + 14 × 16 + 10 × 1 = 1,792 + 224 + 10 = 2,026. In binary that is 111 1110 1010 and in octal 3752.
Decimal to hex: 255
255 ÷ 16 = 15 remainder 15. Fifteen is F, so 255 = FF. In binary it is 1111 1111 — eight ones, the largest value a byte can hold.
A big number: 2⁶⁴ − 1
18,446,744,073,709,551,615 is the largest unsigned 64-bit integer. In hex it is FFFF FFFF FFFF FFFF and in binary sixty-four ones. Ordinary JavaScript numbers can't hold it exactly — they are precise only up to 2⁵³ − 1 = 9,007,199,254,740,991 — but this converter shows every digit correctly.
Quick Reference Table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 5 | 0101 | 5 | 5 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 1 0000 | 20 | 10 |
| 100 | 110 0100 | 144 | 64 |
| 255 | 1111 1111 | 377 | FF |
Shortcuts Between Binary, Octal and Hex
Because 8 = 2³ and 16 = 2⁴, you can convert between binary, octal and hex without going through decimal at all. For hex, split the binary number into groups of four from the right and replace each group with one hex digit: for 2,026 the binary is 111 1110 1010; pad the leftmost group to 0111, and 0111 1110 1010 becomes 7 E A, or 7EA. For octal, use groups of three: 011 111 101 010 → 3752. The grouping option in the converter displays binary in exactly these blocks, which makes it easy to check work by hand.
Where You Meet Different Bases
- Colour codes. A web colour like
#FF8800is three hex bytes — red 255, green 136, blue 0. Our hex to RGB converter does this conversion directly. - File permissions.
chmod 755is octal: 7 = rwx for the owner, 5 = r-x for group and others. - Memory addresses and bit masks. Debuggers, register maps and network masks are written in hex because each digit is exactly four bits.
- Hashes and IDs. SHA-256 hashes from our hash generator and UUIDs are long hex strings; base 36 is popular for short, readable IDs.
- Exams. Number-system conversion is a standard topic in school computer science, digital electronics and aptitude tests.
Why Computers Use Binary
Digital circuits are built from switches that are either on or off, so two states are the most reliable thing to store and detect. A single binary digit is a bit; eight bits make a byte, which can represent 2⁸ = 256 different values, from 0 to 255. Larger quantities use more bytes: 16 bits hold 65,536 values, 32 bits about 4.29 billion, and 64 bits about 18.4 quintillion. The converter's bit count tells you how many bits a number needs — useful when you are choosing a data type or checking whether a value will overflow a field.
Long strings of ones and zeros are hard for people to read, which is why hexadecimal became the standard shorthand. Each hex digit stands for exactly four bits, so a byte is always two hex digits and a 32-bit value is always eight. Octal was popular on older machines whose word sizes were multiples of three bits, and it survives today mainly in Unix permissions.
A Short Note on Two's Complement
When you see a negative number in a debugger, it is usually in two's complement form. To get it for an 8-bit value, write the positive number in binary, flip every bit and add one: 5 is 0000 0101, flipped is 1111 1010, plus one is 1111 1011, which is FB in hex — that is how −5 looks in a byte. The same −5 in 16 bits is FFFB. Because the pattern depends on the width, this converter shows −5 as −101 in binary, the width-independent value. If you need the bit pattern, convert 2ⁿ minus the absolute value: for 8 bits, 256 − 5 = 251, which is FB.
Tips for Practising Conversions
- Memorise the powers of two up to 2¹⁰ = 1,024; they make binary-to-decimal conversion much faster.
- Learn the sixteen four-bit patterns for 0–F; hex and binary then convert by sight.
- Check your hand-worked answers with the converter, and read the grouped binary to spot where an error crept in.
Prefixes, Validation and Edge Cases
If the input starts with 0x, 0b or 0o, the converter reads it in that base and tells you it did so. There is one careful exception: in bases where the prefix letter is itself a valid digit, the text is taken literally. In hexadecimal, for example, b is a digit, so 0b12 typed as hex means the hex number B12 rather than a binary prefix. Spaces and underscores — common digit separators in code — are stripped before conversion. If a character is not a valid digit for the base, such as 2 in binary or G in hex, you get a clear message naming it.
Negative numbers are shown with a minus sign. Hardware stores negative integers in two's complement, but that representation depends on a fixed width (8, 16, 32 or 64 bits), so this tool shows the mathematical value instead. Fractions are not supported; the converter works with whole numbers.
One more clarification: the "Base 32" row is radix 32, using digits 0–9 and a–v. It is not the same as RFC 4648 Base32 encoding, which turns bytes into text using A–Z and 2–7. For encoding text or files, use our Base64 encoder and decoder instead.
Number Base Converter — Key Facts
| 255 decimal | 11111111 binary = FF hex |
|---|---|
| 1 hex digit | 4 bits |
| 1 octal digit | 3 bits |
| Bases supported | 2 to 36 |
| Prefixes | 0x hex · 0b binary · 0o octal |
| Size limit | None (exact BigInt) |
Frequently Asked Questions
How do I convert decimal to binary?
Divide by 2 repeatedly and write down each remainder; reading the remainders from last to first gives the binary number. 13 → 6 r1 → 3 r0 → 1 r1 → 0 r1, so 13 = 1101.
How do I convert binary to decimal?
Multiply each bit by its power of 2 and add. 1101 = 1×8 + 1×4 + 0×2 + 1×1 = 13.
How do I convert hex to decimal?
Each hex digit is a power of 16, with A–F meaning 10–15. 7E = 7×16 + 14 = 126.
Why is one hex digit equal to four bits?
Because 16 = 2⁴. Every hex digit maps to exactly four binary digits (F = 1111, A = 1010), which is why hex is a compact way to write binary.
What is octal used for?
Octal (base 8) groups binary into threes. Today it's mainly seen in Unix file permissions such as chmod 755 and in some older systems.
Can it convert very large numbers?
Yes. It uses exact big-integer arithmetic, so numbers far beyond 2⁵³ or 64 bits convert without rounding errors.
Does it handle negative numbers?
Yes, with a minus sign: −255 is −11111111 in binary. It does not show two's-complement bit patterns, which depend on a fixed bit width.
Does it convert fractions like 0.5?
No. It converts whole numbers (integers) only. Fractional base conversion often produces repeating digits and is a different calculation.
What do 0x, 0b and 0o mean?
They are prefixes used in programming: 0x for hexadecimal, 0b for binary and 0o for octal. The converter detects them automatically.
What is base 36?
Base 36 uses digits 0–9 and letters a–z, the most compact case-insensitive alphanumeric base. It's used for short IDs and URL shorteners.
Is 'base 32' here the same as Base32 encoding?
No. This is radix 32 (digits 0–9 then a–v), a number system. RFC 4648 Base32 is a byte encoding that uses A–Z and 2–7 — a different thing.
Is it free and private?
Yes, free, and everything runs in your browser — nothing is uploaded.
Convert Any Number Base!
Binary, octal, decimal and hex — exact and free.
Explore More Prompt Minds Tools
Number Base Converter works great alongside our other free tools. Every Prompt Minds tool runs entirely in your browser — no sign-up, no uploads, no watermarks. Browse all free tools.
