Base Number Converter

Convert numbers between binary, decimal, hex, and any base

Enter a number, select its current base, and choose the target base. The result also shows binary, octal, decimal, and hex for quick reference.

Number bases: how different positional systems represent the same value

A number base (or radix) defines how many unique digit symbols are used to represent numbers and how position determines value. In our everyday decimal system, the base is 10 and the digits run from 0 to 9. Each position is worth ten times the position to its right: ones, tens, hundreds, thousands, and so on. The same principle applies in every positional number system; only the base changes.

Binary (base 2) uses only the digits 0 and 1. It is the native language of digital computers because electronic circuits have two stable states: on and off, high and low voltage, which map naturally to 1 and 0. The decimal number 13 in binary is 1101, because 1x8 + 1x4 + 0x2 + 1x1 = 13. Every piece of data in a computer — text, images, video, programs — is ultimately represented as a sequence of bits in binary.

Octal (base 8) uses digits 0 through 7. It was historically used in older computing systems and still appears in Unix and Linux file permission settings, where a three-digit octal number compactly represents nine bits of read/write/execute permissions. The decimal number 255 in octal is 377, since 3x64 + 7x8 + 7x1 = 255.

Hexadecimal (base 16) uses digits 0 through 9 and letters A through F (where A=10, B=11, C=12, D=13, E=14, F=15). It is widely used in computing because each hex digit represents exactly four binary digits (bits), making it a compact and human-readable way to write binary data. A byte (8 bits) can always be written as exactly two hex digits. Colour codes in web design use hex (for example #FF5733), memory addresses use hex, and many data formats use hex as their standard display notation.

How base conversion works

Converting a number from any base to decimal is done by multiplying each digit by its positional value and summing the results. For the binary number 1101: 1x2^3 + 1x2^2 + 0x2^1 + 1x2^0 = 8 + 4 + 0 + 1 = 13. For the hex number 1F: 1x16^1 + 15x16^0 = 16 + 15 = 31. Converting from decimal to another base uses repeated division: divide the decimal number by the target base, record the remainder, and repeat with the quotient until the quotient reaches zero. The remainders, read from last to first, give the number in the new base.

This calculator uses JavaScript's built-in parseInt(number, fromBase) to parse the input and result.toString(toBase) to produce the output. These functions handle bases from 2 to 36. For bases above 10, letters a through z (case insensitive) represent digit values 10 through 35, which is the standard convention. The output is shown in uppercase for readability.

Custom bases and practical examples

Custom bases between 2 and 36 cover a wide range of niche applications. Base 3 (ternary) is used in some mathematical puzzles and theoretical computing. Base 12 (duodecimal) is argued by some mathematicians to be superior to base 10 for everyday arithmetic because 12 has more divisors (1, 2, 3, 4, 6, 12) than 10 (1, 2, 5, 10). Base 60 (sexagesimal), the system used by ancient Babylonians and still used for time (60 seconds per minute, 60 minutes per hour) and angle measurement (360 degrees = 6 x 60), exceeds the 36-digit limit of this calculator, but conversions to and from decimal for time values can be done manually. Bases 2, 8, 10, and 16 remain the most practically relevant in modern computing and mathematics.

Last updated: 2026-05-06