Number Base Converter

Convert numbers between binary, octal, decimal and hex.

Something not working, or a feature missing?Report a problem or suggest a tool

How to Use

  1. 1Enter a number and select its base.
  2. 2View the converted value in all other bases instantly.

Features

  • Binary, octal, decimal, hexadecimal
  • Live conversion as you type
  • Clear error for invalid digits

Example

Input

255 (decimal)

Output

FF (hex), 11111111 (binary)

Convert numbers between binary, octal, decimal and hexadecimal instantly, entirely in your browser.

Four number systems

Computers store everything in binary, but people find long strings of 0s and 1s hard to read, so programmers also use octal and hexadecimal as compact ways to write the same values. Enter a number, choose its base, and see it in binary, octal, decimal and hexadecimal at the same time.

DecimalBinaryOctalHex
10101012A
15111117F
16100002010
100110010014464
25511111111377FF
1024100000000002000400

Where you meet each base

  • Hexadecimal (base 16): web colours (#FF8800), memory addresses, MAC addresses, Unicode code points (U+0915) and hashes. Each hex digit is exactly four bits, so one byte is always two hex digits.
  • Binary (base 2): bit flags, network subnet masks (255.255.255.0 is 24 ones followed by 8 zeros), and understanding how data is stored.
  • Octal (base 8): Unix file permissions. chmod 755 means rwx for the owner (7 = 111) and r-x for everyone else (5 = 101).

Reading a web colour

A colour like #1E90FF is three hex pairs for red, green and blue: 1E = 30, 90 = 144, FF = 255. That is how design tools convert between hex codes and RGB values.

Limits

Each digit must be valid for its base: only 0 and 1 in binary, 0–7 in octal, and 0–9 plus A–F in hex (upper or lower case). Very large numbers, beyond about 9 quadrillion (2^53), exceed the precision of JavaScript numbers, so the last digits of huge values may not be exact.

Prefixes such as 0x (hex), 0b (binary) and 0o (octal) are how many programming languages mark a base. Leave them out when typing here and choose the base from the menu instead.

Frequently Asked Questions