Skip to content

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal, and any custom base.

Number Base Converter tool

Loading...

Example

Input: Decimal number 255 (from base 10)

Result: Binary 11111111, octal 377, hexadecimal FF

255 = 2^8 - 1, which is eight 1 bits; 255 = 15 x 16 + 15 = FF in hex, and 3 x 64 + 7 x 8 + 7 = 377 in octal.

Decimal, Binary, Octal and Hex

DecimalBinaryOctalHex
1111
21022
711177
81000108
10101012A
15111117F
16100002010
42101010522A
64100000010040
100110010014464
12711111111777F
25511111111377FF
256100000000400100
1000111110100017503E8
655351111111111111111177777FFFF
  1. Select the input base: binary (2), octal (8), decimal (10), hexadecimal (16), or any base from 2 to 36.
  2. Enter your whole number using valid digits for the selected base.
  3. View the number converted to all four common bases simultaneously, plus grouped binary (4-digit clusters) and hex (pairs).
  4. Enter a custom base from 2 to 36 to see the number in that base as well.
  5. Click the copy button next to any base conversion to copy it.

Binary, Octal, Decimal and Hex Explained

A number base is how many digits a counting system uses before it carries over. Decimal uses 10, binary uses 2 and hexadecimal uses 16. So 255 in decimal is 11111111 in binary and FF in hex. This converter takes a whole number in any base from 2 to 36. It shows the number in binary, octal, decimal, hex and a custom base of your choice.

Every base works on place value. Each position is worth the base times the position to its right. In binary, 1101 means 8 + 4 + 0 + 1 = 13. Hexadecimal needs six extra digits, so it uses A to F for 10 to 15. Bases above 16 carry on through the alphabet, up to Z for 35 in base 36.

Programmers use hex because one hex digit is exactly four binary digits. Two hex digits make one byte, so FF is 11111111. The tool also shows binary in groups of four and hex in pairs to make long values easier to read. Octal still appears in Unix file permissions such as 755, which the Chmod Calculator explains. Web colors such as #FF8800 are three hex bytes, which the Hex to RGB Converter splits apart.

Input is forgiving. Letters can be upper or lower case, and spaces and underscores are ignored. The prefixes 0x, 0b and 0o work for hex, binary and octal. The converter uses exact big-number math, so very long values convert with no rounding.

There are two limits. Only whole numbers are supported, not fractions. Negative numbers simply keep their minus sign, so -5 becomes -101. That is not the two's complement bit pattern a computer uses to store negative values.

Formula / How It Works

Value = sum of (digit x base^position) for each digit | Decimal to base b: repeatedly divide by b, collect remainders

Frequently Asked Questions

Multiply each binary digit by its place value and add them up. The place values, from the right, are 1, 2, 4, 8, 16 and so on. So 1101 is 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 13. To check, enter 1101 with Binary as the From Base.
Divide by 2 again and again, writing down each remainder, until you reach 0. Then read the remainders from last to first. For 13: 13 / 2 = 6 r 1, 6 / 2 = 3 r 0, 3 / 2 = 1 r 1, 1 / 2 = 0 r 1. Reading upward gives 1101.
Each hex digit stands for exactly four binary digits, so hex is a compact way to write binary. One byte is always two hex digits, from 00 to FF. That makes memory addresses, color codes and raw data much easier to read than long strings of 1s and 0s.
Base 36 uses all ten digits and all 26 letters, so it is the largest base that fits in plain letters and numbers. It turns big numbers into short codes. For example, 1,000,000 in base 36 is LFLS. Some short links and ID systems use it for that reason.
The converter keeps a leading minus sign, so -10 in decimal becomes -1010 in binary and -A in hex. Computers usually store negative integers in two's complement form, which depends on the number of bits used. This tool does not produce that form.

Related Tools

Roman Numeral Converter

Convert between Roman numerals and Arabic (decimal) numbers in both directions.

Math and Numbers

Scientific Notation Converter

Convert between standard numbers and scientific notation with E-notation support.

Math and Numbers

Hash Generator

Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text or files right in your browser.

Developer Tools

Hex to RGB Converter

Convert hexadecimal color codes to RGB values instantly. Supports shorthand and 8-digit hex with alpha.

Color Tools

Text to Binary Converter

Convert text to binary and binary back to text. Supports ASCII and UTF-8 encoding with space-separated bytes.

Text and Writing

IPv4 Address Converter

Convert IPv4 addresses between decimal, binary, hexadecimal, and integer representations instantly.

Network Tools