SahlCalc سهل
Gulf Hubs:

Saudi Arabia: Labour: HRSD · Tax and zakat: ZATCA

Number Base Converter

Convert a whole number between binary, octal, decimal, hexadecimal or any base from 2 to 36.

Digits 0–9, then letters A–Z above base 10, e.g. 255, 11111111 or FF

2 to 36: 2 binary, 8 octal, 10 decimal, 16 hex

2 to 36, e.g. 2 for binary or 16 for hex

In base 2

11111111

Decimal (10)

255

Binary (2)

1111 1111

Octal (8)

377

Hexadecimal (16)

FF

Formula with your numbers

  • Digits 255₍10₎ = 255₍₁₀₎ = 11111111₍2₎

Quick answer: 255 in decimal is 1111 1111 in binary (8 ones), 377 in octal and FF in hexadecimal.

How it's calculated

In base b, each digit is worth b times the digit to its right: 2F in hexadecimal is 2 × 16 + 15 = 47. Digits above 9 are letters: A = 10, B = 11 … Z = 35, so base 36 uses 0–9 and A–Z.

To convert, the number is read into its value, then divided by the new base again and again; the remainders, read backwards, are the new digits. Calculations use exact big integers, so long binary or hex values do not lose digits.

Prefixes 0x (hex), 0b (binary) and 0o (octal) are accepted and ignored. Fractions are not converted.

Worked examples

  • 255 (base 10) → base 16: FF
  • 1010 (base 2) → base 10: 1×8 + 0×4 + 1×2 + 0 = 10
  • 2F (base 16) → base 10: 2 × 16 + 15 = 47

Decimal, binary, octal and hex

DecimalBinaryOctalHex
0000
1111
21022
711177
81000108
10101012A
15111117F
16100002010
321000004020
100110010014464
25511111111377FF
256100000000400100
1000111110100017503E8
1024100000000002000400

Frequently asked questions

Why do programmers use hexadecimal?

One hex digit is exactly four binary digits, so a byte (8 bits) is always two hex digits, such as FF for 255.

What is the highest base supported?

Base 36, which uses all ten digits and 26 letters.

Are negative numbers supported?

Yes, with a leading minus sign. The result is shown with a minus sign, not as two's complement.

How do I convert binary to decimal by hand?

Under each digit, from the right, write 1, 2, 4, 8 and so on, then add up the ones sitting under a 1. For 1011 that's 8 + 2 + 1 = 11.

What is 255 in hexadecimal?

FF, the biggest number a single byte can hold.

Why is octal still used?

Each octal digit stands for exactly three bits, which suited early computers. These days you'll mostly meet it in Unix file permissions like 755.