Binary / Hex / Octal Converter

Convert numbers between decimal, binary, octal, and hexadecimal.

By Konstantin Iakovlev · Updated September 2026 · Source: Khan Academy

Input Base

Decimal

255

Hexadecimal

0xFF

All Representations

Decimal (Base 10)255
Binary (Base 2)11111111
Octal (Base 8)377
Hexadecimal (Base 16)FF

Use the Binary / Hex / Octal Converter above to calculate your results. Enter your values and see instant results — all calculations run in your browser.

Disclaimer: This calculator is for informational purposes only. Results are estimates based on the information you provide and the assumptions described on this page.

How It Works

Numbers move freely here across decimal (base-10), binary (base-2), octal (base-8), and hexadecimal (base-16). These conversions are foundational in computer science, networking, and embedded systems work.

Standard base-conversion algorithms do the work. Going from decimal into binary, octal, or hex means dividing repeatedly by the target base and collecting the remainders. Going the other way, into decimal, means summing each digit multiplied by the matching power of its base.

Two characters cause most of the trouble: hexadecimal '0' read as the letter 'O', and '1' read as 'l'. Confirm which base you are starting from and which you are converting to before you trust a result. Note as well that hexadecimal uses A-F to stand for the values 10-15.

Example: Converting a Hexadecimal Memory Address

  1. 1 A debugger shows a memory address as 0x1A4F, and you want its decimal value.
  2. 2 Choose 'Hex' as the input base and enter 1A4F (the 0x prefix is optional). The conversion is (1 × 16^3) + (10 × 16^2) + (4 × 16^1) + (15 × 16^0) = 4,096 + 2,560 + 64 + 15.
  3. 3 The calculator shows decimal 6735 and hexadecimal 0x1A4F, and its table lists all four forms at once: binary 1101001001111 and octal 15117 as well.
  4. 4 The binary form shows why hex is handy: each hex digit stands for exactly four bits, 1 = 0001, A = 1010, 4 = 0100 and F = 1111.

Source: Khan Academy · Last updated: September 2026

Frequently Asked Questions

How do you convert decimal to binary?
Repeatedly divide by 2 and record the remainders from bottom to top. For example, 13: 13÷2=6r1, 6÷2=3r0, 3÷2=1r1, 1÷2=0r1. Reading remainders upward: 1101.
How do you convert hex to decimal?
Multiply each hex digit by its position value (powers of 16) from right to left. For hex 2F: F(15)x1 + 2x16 = 15 + 32 = 47 decimal.
Why do programmers use hexadecimal?
Hexadecimal is compact (1 hex digit = 4 binary digits) and convenient for representing memory addresses, color codes, and byte values. Two hex digits represent one byte (0-255), making binary data much easier to read.