Base Converter

Binary, octal, decimal, hex

About This Calculator

Number base conversion translates a number from one numeral system to another. Binary (base 2) is used by computers, octal (base 8) in file permissions, hexadecimal (base 16) in color codes and memory addresses, and decimal (base 10) in everyday use.

Formula

To decimal: multiply each digit by base^position and sum
From decimal: repeatedly divide by target base, read remainders upward
Hex shortcut: each hex digit = 4 binary bits (nibble)

Example Calculation

Convert 255 decimal to binary, hex, and octal

  1. 255 / 2 repeatedly: 11111111 binary
  2. 255 / 16 = 15 rem 15 = FF hex
  3. 255 / 8 repeatedly: 377 octal
255 decimal = 11111111 binary = FF hex = 377 octal

Decimal 0-15 in Binary, Octal, and Hex

DecimalBinaryOctalHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Frequently Asked Questions

Why do computers use binary?
Computer hardware represents data with two electrical states (on/off, high/low voltage), making binary the natural number system. Every number, text character, image, and instruction is ultimately stored as a sequence of 0s and 1s.
What is hexadecimal used for in programming?
Hex is used for memory addresses, color codes (#FF5733), byte values, and binary data because each hex digit maps to exactly 4 binary bits, making long binary strings much more readable.
How do I convert binary to hex quickly?
Group binary digits into groups of 4 from the right, then convert each group to one hex digit. For example, 11011010 = 1101 1010 = D A = DA in hex.
What does 0x mean before a number?
The 0x prefix denotes a hexadecimal number in programming (e.g. 0xFF = 255). Similarly, 0b means binary (0b1010 = 10) and 0o or 0 means octal in various languages.