Skip to main content

Binary, Decimal & Hex Converter

Decimal, Binary, Octal, Hexadecimal Converter

Type a number in any field and the others convert instantly.
Binary
Base 2
Octal
Base 8
Decimal
Base 10
Hexadecimal
Base 16

Number base calculator

÷ gives the integer quotient and remainder; AND, OR, XOR and shifts work on the binary bits.

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​

  1. Type in the field you want to convert from. For example, enter FF in “Hexadecimal” and the other fields show 11111111, 377 and 255 right away.
  2. Paste values straight from code: 0x, 0b and 0o prefixes, spaces and underscores (such as 1111_0000) are ignored.
  3. 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.
  4. Tick “Group binary digits by 4” to show binary as 1111 1111, which is easier to match against hex.
  5. 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 = 100 remainder 1.
  • 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 systemBaseDigitsCommon uses
Binary20, 1Computers, logic circuits
Octal80–7Linux file permissions (e.g. chmod 755)
Decimal100–9Everyday life
Hexadecimal160–9, A–FMemory 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​

DecimalBinaryOctalHexadecimal
0000
1111
21022
31133
410044
510155
611066
711177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
16100002010
321000004020
64100000010040
100110010014464
1281000000020080
25511111111377FF
256100000000400100

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).

Other useful tools