DevToolbox

Number Base Converter

Convert between binary, octal, decimal, and hexadecimal

Input base

Enter a number to see conversions

Quick reference

Dec
Bin
Oct
Hex
0
0
0
0
1
1
1
1
2
10
2
2
4
100
4
4
8
1000
10
8
10
1010
12
A
15
1111
17
F
16
10000
20
10
32
100000
40
20
64
1000000
100
40
128
10000000
200
80
255
11111111
377
FF

Related tools

What is number base conversion?

Number base conversion transforms a number from one positional numeral system to another. Binary (base 2) is used in computing, octal (base 8) in file permissions, decimal (base 10) in everyday math, and hexadecimal (base 16) in memory addresses and color codes. This tool converts between all four instantly.

Why numbers have different bases

The same value can be written in different number systems. Decimal (base 10) is what people use daily; binary (base 2) is how computers store everything; hexadecimal (base 16) is a compact way to write binary that programmers use for colors, memory addresses, and byte values; octal (base 8) appears in file permissions. Converting between bases lets you move between how a human, a program, and the hardware each prefer to see a number.

Each base uses a different set of digits — binary uses 0 and 1, hex adds the letters A–F for the values ten to fifteen — but they all describe the same underlying quantity.

Where each base shows up

You will meet hexadecimal in CSS colors like #FF0000 and in hash values, binary when working with bitmasks and flags, and octal in Unix file permissions such as 755. Being able to convert quickly between them removes a common source of off-by-one and misread-value bugs.

Reading binary and hex quickly

A useful habit is to group binary digits in fours, because each group of four bits maps to exactly one hexadecimal digit. That makes 1111 the same as F and 1010 the same as A, so you can translate between binary and hex in your head once the sixteen patterns become familiar.

How to convert a number between bases

  1. 1Enter a number. Type a value in binary, octal, decimal, or hexadecimal.
  2. 2Click Convert. The equivalent value in every other base is calculated instantly.
  3. 3Copy the base you need. Copy the representation your code or system expects.

Examples

Decimal to other bases

Input

255

Output

Binary 11111111 · Octal 377 · Hex FF

Hex to decimal

Input

0x1A

Output

Decimal 26 · Binary 11010

Binary to decimal

Input

1010

Output

Decimal 10 · Hex A

Number bases

The four common bases and their digits.

BaseNameDigits
2Binary0–1
8Octal0–7
10Decimal0–9
16Hexadecimal0–9, A–F

Frequently asked questions

What is hexadecimal used for?+

Hex is a compact way to write binary: two hex digits equal one byte. It is used for CSS colors, memory addresses, hash values, and byte-level data.

Why do computers use binary?+

Hardware stores data as on/off states, which map directly to the 1s and 0s of binary. Every other base is a convenience for humans reading that data.

What does the 0x prefix mean?+

0x marks a hexadecimal number in many languages, just as 0b marks binary and 0o marks octal. The tool accepts numbers with or without these prefixes.

Can it convert very large numbers?+

Yes. Conversion is exact for large integers, so you can translate long hash or address values without rounding.

Is the conversion private?+

Yes. It runs in your browser with nothing sent to a server.

Is it free?+

Yes — free with no limits.

What is a nibble?+

Four bits — half a byte — which is exactly one hexadecimal digit. Two nibbles make one byte, written as two hex characters.