Number Base Converter

Binary, octal, decimal and hexadecimal in one conversion.

11111111Value in base 2
Decimal
255
Binary
11111111
Octal
377
Hexadecimal
FF
Bits needed
8 Fits in one byte

255 (base 10) = 11111111 (base 2)

About the Number Base Converter

Computers count in binary, memory dumps and colour codes are written in hexadecimal, Unix file permissions use octal and humans use decimal. Converting between them by hand is slow and error prone, so this tool takes a value in any of those bases (or any base up to 36) and shows it in all of them at once, along with how many bits it needs.

Hexadecimal is the most common in day-to-day work because each hex digit maps to exactly four bits: FF is 255, which is one byte at its maximum, and the CSS colour #FF8800 is simply three byte values. Octal survives mainly in file modes, where 755 means read-write-execute for the owner and read-execute for everyone else.

How to use the Number Base Converter

  1. Type the number you want to convert. Prefixes such as 0x, 0b and 0o are accepted and ignored.
  2. Choose the base your number is written in and the base you want.
  3. Read the converted value, plus the decimal, binary, octal and hex forms listed underneath.

Frequently asked questions

How do I convert binary to decimal?

Multiply each digit by its power of two and add them up. 1011 is 8 + 0 + 2 + 1 = 11. The converter does this instantly for numbers of any length up to the precision limit.

Why is hexadecimal used in programming?

One hex digit represents exactly four binary digits, so a byte is always two hex characters. That makes memory addresses, colour codes and byte dumps far shorter to read than binary.

What do the 0x and 0b prefixes mean?

0x marks a hexadecimal literal and 0b a binary one in most programming languages; 0o marks octal. This tool strips them automatically so you can paste code directly.

What is the largest number I can convert?

Values are handled as JavaScript numbers, so results stay exact up to 9,007,199,254,740,991 (2 to the power 53 minus 1). Larger values lose precision.