Number Base Converter (Binary, Octal, Decimal, Hex)

Type a number into any of the four fields and the other bases update right away. There's no digit limit, so even very large numbers convert exactly.

Binary (grouped in 4s)
1111 1111
8-bit · hex FF

Spaces, underscores (_) and commas are ignored. You can also use the 0x, 0b and 0o prefixes and negative numbers (-).

How to use the Number Base Converter

  1. Type a number into the field for the base you already have, for example 255 in the decimal field.
  2. The binary, octal and hex fields update as you type.
  3. For other bases such as base 3 or base 36, pick one under Choose another base.
  4. Use the copy buttons to copy a result. Binary is shown in groups of four digits so the bits are easy to count.

How to convert decimal to binary

Keep dividing the decimal number by 2, then read the remainders from bottom to top. That gives you the binary number. Here's 13 as an example:

DivisionQuotientRemainder
13 ÷ 261
6 ÷ 230
3 ÷ 211
1 ÷ 201

Read the remainders in reverse and you get 1101. Octal and hex work the same way: just divide by 8 or 16 instead.

How to convert binary to decimal

Start at the rightmost digit. Multiply each digit by its place value, which goes 1, 2, 4, 8, 16 and so on (the powers of 2), then add up the results.

1101₂ = 1×8 + 1×4 + 0×2 + 1×1 = 13

In hexadecimal the place values are 1, 16, 256, 4096 and so on, and the letters A to F stand for 10 to 15. For example, FF₁₆ = 15×16 + 15 = 255 and 1A₁₆ = 1×16 + 10 = 26.

Why four binary digits make one hex digit

Because 16 = 2⁴, every group of four binary digits matches exactly one hex digit. Split a binary number into groups of four starting from the right and you can read off the hex value directly. Octal works the same way with groups of three binary digits.

BinaryHexBinaryHex
0000010008
001131010A
010151100C
011171111F

Example: 1011 0110₂ = B6₁₆ = 182. A color code like #FF8800 is just three pairs of hex digits (255, 136, 0). You can see it as RGB in the color code converter.

Where are number bases used?

  • Binary: all data inside a computer, bitwise operations and permission flags
  • Octal: Unix and Linux file permissions (for example, chmod 755 = rwxr-xr-x)
  • Hexadecimal: memory addresses, web color codes, Unicode code points (U+00E9 = 'é'), MAC addresses
  • Base 36: short IDs and URL shortener codes, since it uses all of 0–9 and A–Z

Negative numbers in binary: two's complement

Computers usually store negative numbers in two's complement. To get the negative of a number, take its binary form, flip every bit (0↔1) and add 1. In 8 bits, 5 is 0000 0101 and −5 is 1111 1011. −1 has every bit set: 1111 1111 (hex FF).

This converter shows negative numbers mathematically, with a minus sign in front. If you need the two's complement for a specific bit width, work it out yourself using the method above.

Frequently asked questions

Can I convert negative numbers?
Yes. Put a minus sign (-) in front and the sign carries over to every result. This is not the same as the two's complement form computers use internally. For bitwise work, you'll need to calculate the complement yourself for your bit width.
Does it work with decimal fractions?
No. This converter only handles whole numbers (integers), because fractions often turn into endlessly repeating digits in other bases.
How large a number can it convert?
It uses JavaScript BigInt, so there's no digit limit and conversions are exact. Even numbers dozens of digits long have no rounding errors.
Should I type hex in uppercase or lowercase?
Either one works. Results are shown in uppercase because that's easier to read.
Can I paste values like 0xFF or 0b1010?
Yes. The 0x, 0b and 0o prefixes are accepted. Spaces, underscores and commas are ignored, so values like 1111_0000 or 1,000,000 also work.

Last updated: 2026-10-06