Binary, Decimal & Hex Converter
Decimal, Binary, Octal, Hexadecimal Converter
Number base calculator
Type a number in any field and the other bases update instantly: binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16), with no digit limit and support for negative numbers. The Number base calculator below lets you add, subtract, multiply, divide and run bitwise operations directly in binary or hex – handy for programming, computer science classes or checking homework.
How to use the converter
- Type in the field you want to convert from. For example, enter
FFin “Hexadecimal” and the other fields show11111111,377and255right away. - Paste values straight from code:
0x,0band0oprefixes, spaces and underscores (such as1111_0000) are ignored. - If you type a character the base doesn’t allow (such as a 2 in binary), a message appears under the field instead of a wrong result.
- Tick “Group binary digits by 4” to show binary as
1111 1111, which is easier to match against hex. - Use the copy icon next to a field to copy the result, or press “Clear” to start over.
Number base calculator
Choose a base, enter two numbers and pick an operation; the result is shown in all four bases:
- + − × ÷: arithmetic. ÷ gives the integer quotient and remainder, e.g. binary
1101 ÷ 11=100remainder1. - mod: remainder only.
- AND, OR, XOR: bitwise operations, often used for masks and flags.
- <<, >>: left and right shift. Shifting left by 1 multiplies by 2; shifting right by 1 divides by 2 (rounded down).
What are binary, octal, decimal and hexadecimal?
A number system’s base is how many digits it uses before carrying over to the next place:
| Number system | Base | Digits | Common uses |
|---|---|---|---|
| Binary | 2 | 0, 1 | Computers, logic circuits |
| Octal | 8 | 0–7 | Linux file permissions (e.g. chmod 755) |
| Decimal | 10 | 0–9 | Everyday life |
| Hexadecimal | 16 | 0–9, A–F | Memory addresses, web colors, MAC addresses |
In hexadecimal, A–F stand for 10–15. One hex digit is exactly 4 binary bits, so two hex digits make one byte – which is why code and web colors (such as #FF8800) use hex so often.
How to convert by hand
Decimal to binary: divide by 2 and keep the remainders
Keep dividing the decimal number by 2, write down each remainder, then read the remainders from bottom to top. For 13:
- 13 ÷ 2 = 6 remainder 1
- 6 ÷ 2 = 3 remainder 0
- 3 ÷ 2 = 1 remainder 1
- 1 ÷ 2 = 0 remainder 1
Reading from bottom to top gives 1101. Octal and hex work the same way – divide by 8 or 16 instead. For example, 255 ÷ 16 = 15 remainder 15, and 15 is F, so 255 = FF.
Binary to decimal: add up the place values
From right to left, the place values are 1, 2, 4, 8, 16… (powers of 2). Add up the place values where the bit is 1:
1101 = 1×8 + 1×4 + 0×2 + 1×1 = 13
Hex works the same way with place values 1, 16, 256…, so 2F = 2×16 + 15×1 = 47.
Binary to hex and back: groups of 4
Starting from the right, split the binary number into groups of 4 bits and turn each group into one hex digit using the table below:
10101111 → 1010 1111 → A F → AF
To go back, replace each hex digit with 4 bits. For binary to octal, use groups of 3 instead: 111101 → 111 101 → 75.
Conversion table
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
Frequently asked questions
How do I convert binary to decimal?
From right to left, the place values are 1, 2, 4, 8, 16… Add up the place values where the digit is 1. For example, 1101 = 8 + 4 + 1 = 13.
How do I convert decimal to binary?
Divide the number by 2 repeatedly and write down each remainder until the quotient is 0, then read the remainders from bottom to top. For 13 the remainders are 1, 0, 1, 1, so the answer is 1101.
What do A–F mean in hexadecimal?
Hexadecimal needs 16 symbols, so after 0–9 it uses A–F for 10–15: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. Upper and lower case mean the same; this tool always shows upper case.
Can I enter negative numbers or decimals?
Negative numbers are supported and keep a minus sign (for example, -255 in hex is -FF); this is not the two’s complement form used inside computers. Only whole numbers are supported, not fractions.
Is it accurate for very large numbers?
Yes. This tool uses JavaScript BigInt, so there is no digit limit and numbers of 64 bits or more convert exactly. Converters that use ordinary floating-point numbers lose precision above about 9 quadrillion (2 to the power of 53).
- Unix timestamp converter: convert timestamps and dates.
- Base64 encoder: encode text as Base64.
- UUID generator: generate unique identifiers.