How to Convert Decimal to Binary, Hex & Octal

Updated 2026-06-21

To convert a decimal number to binary, hexadecimal, or octal, divide the number repeatedly by the target base (2 for binary, 16 for hex, 8 for octal) and read the remainders from bottom to top. The fastest way is to paste your number into a base converter and read all four bases at once.

Convert decimal to binary by hand

The repeated-division (remainder) method works for any base. To turn decimal 156 into binary:

  1. 156 ÷ 2 = 78, remainder 0
  2. 78 ÷ 2 = 39, remainder 0
  3. 39 ÷ 2 = 19, remainder 1
  4. 19 ÷ 2 = 9, remainder 1
  5. 9 ÷ 2 = 4, remainder 1
  6. 4 ÷ 2 = 2, remainder 0
  7. 2 ÷ 2 = 1, remainder 0
  8. 1 ÷ 2 = 0, remainder 1

Read the remainders from last to first: 10011100. That is 156 in binary. Swap the divisor for 16 to get hex, or 8 to get octal — the method is identical.

A faster way: convert all bases at once

Hand calculation is fine for small numbers but slow and error-prone once values get large. Open the Number Base Converter, pick your input base (Bin, Oct, Dec, or Hex), and type a value. It instantly shows the binary, octal, decimal, and hex equivalents side by side, plus any custom base from 2 to 36. Each row has a copy button.

The tool understands the way developers actually write numbers:

Because it uses BigInt, there is no upper limit baked into a 32- or 64-bit register — you can convert numbers with hundreds of digits without losing precision.

Read the bits and run bitwise math

Beyond plain conversion, the converter shows the bit length and byte length of your value, and a "bits view" that groups the binary into nibbles and bytes so you can scan a byte boundary at a glance — handy when working with flags, masks, or color values.

Turn on bitwise operations to combine two values with AND, OR, XOR, or left/right shifts (<< and >>). Enter a second operand in the same base and read the result across every base at once. This is the quick path for checking a bitmask, setting a flag, or sanity-checking a shift before you write the code.

It runs entirely in your browser

Every conversion happens locally in your tab. Nothing you type is uploaded to a server, there is no signup, and the math runs instantly offline once the page has loaded — useful when you are pasting in addresses, keys, or values you would rather not send anywhere.

Ready to convert? Open the Number Base Converter and read binary, octal, decimal, hex, and any base together.

Try the Number Base Converter →