Number Base Converter

Convert numbers between any base from 2 to 36

Conversion Result

Decimal

255

Base 2

11111111

Hexadecimal

FF

Digit Count by Base

Multi-Base Table

BaseValueDigits
Base 2111111118
Base 83773
Base 102553
Base 16FF2

Understanding Number Bases

What Is a Number Base?

A number base (or radix) is the number of unique digits used to represent numbers. Base-10 (decimal) uses digits 0-9. Base-2 (binary) uses 0-1. Base-16 (hexadecimal) uses 0-9 and A-F.

Common Number Bases

Binary (base-2) is fundamental in computing. Octal (base-8) is used in Unix file permissions. Decimal (base-10) is the everyday system. Hexadecimal (base-16) is used for memory addresses, colors, and data encoding.

How Conversion Works

To convert from any base to decimal, multiply each digit by its positional weight (base^position) and sum. To convert from decimal to any base, repeatedly divide by the target base and collect remainders.

Positional Notation

In base-b, the number dₙdₙ₋₁...d₁d₀ equals dₙ×bⁿ + dₙ₋₁×bⁿ⁻¹ + ... + d₁×b + d₀. For example, 1A hex = 1×16 + 10 = 26 decimal.

Applications

Binary is the language of computers. Hex simplifies binary representation (4 binary digits = 1 hex digit). Base-64 encodes binary data as text. Base-36 provides compact alphanumeric identifiers.

What Are Number Bases?

A number base (or radix) is the number of unique digits used to represent numbers in a positional numeral system. The familiar decimal system uses base 10 with digits 0-9, but this is just one of many possible bases. Binary (base 2) uses only 0 and 1, octal (base 8) uses 0-7, and hexadecimal (base 16) uses 0-9 plus A-F. Number base conversion — translating numbers between different bases — is fundamental to computer science, digital electronics, and mathematics, as different bases offer advantages for different applications. Understanding number bases reveals the underlying structure of our number system and how computers represent and manipulate all forms of data.

Why Different Number Bases Exist

Different bases have evolved for different purposes. Base 10 became dominant in human culture likely because humans have ten fingers, making finger-counting natural in decimal. Base 60 (sexagesimal) originated with the ancient Sumerians and Babylonians and survives today in our measurement of time (60 seconds per minute, 60 minutes per hour) and angles (360 degrees in a circle). Base 12 (duodecimal) has advocates who note that 12 is divisible by 2, 3, 4, and 6, making fractional arithmetic simpler — this is why we count dozens and why many measurement systems use factors of 12. Binary (base 2) dominates computing because electronic circuits naturally represent two states: on/off or high/low voltage. Octal (base 8) and hexadecimal (base 16) serve as convenient shorthands for binary because 8 and 16 are powers of 2, making conversion between these bases and binary trivial — each octal digit represents exactly 3 binary digits, and each hexadecimal digit represents exactly 4 binary digits.

How Positional Number Systems Work

In a positional numeral system with base b, each digit position represents a power of b. In decimal (base 10), the number 3,728 means 3×10³ + 7×10² + 2×10¹ + 8×10⁰ = 3,000 + 700 + 20 + 8. The same principle applies in any base. In binary, 10110 means 1×2⁴ + 0×2³ + 1×2² + 1×2¹ + 0×2⁰ = 16 + 0 + 4 + 2 + 0 = 22 in decimal. In hexadecimal, 2F3 means 2×16² + 15×16¹ + 3×16⁰ = 512 + 240 + 3 = 755 in decimal. For bases larger than 10, letters serve as digits: A=10, B=11, C=12, D=13, E=14, F=15 in hexadecimal, and the pattern continues for even larger bases. This positional system is what makes base conversion possible — any number can be expressed as a sum of powers of any base, with coefficients (digits) ranging from 0 to b-1.

Conversion Methods Between Bases

The two primary methods for converting between bases are the division-remainder method (for converting from decimal to any base) and the expansion method (for converting from any base to decimal). To convert decimal 42 to binary: repeatedly divide by 2 and record remainders — 42÷2=21 R0, 21÷2=10 R1, 10÷2=5 R0, 5÷2=2 R1, 2÷2=1 R0, 1÷2=0 R1. Reading remainders bottom-to-top gives 101010. To convert from any base to decimal, expand using powers: hex 3A7 = 3×256 + 10×16 + 7×1 = 935. For direct conversion between non-decimal bases (like binary to hexadecimal), group binary digits in sets of 4 (from right) and replace each group with its hex equivalent: 1010 0111 = A7 in hexadecimal. A number base converter automates all these methods, handling fractional parts, negative numbers, and bases from 2 to 36 with instant accuracy.

Number Bases in Computing and Digital Systems

Binary is the native language of all digital computers because transistors have two stable states, making base 2 the natural representation. However, binary numbers are cumbersome for humans to read — the decimal number 255 requires 8 binary digits (11111111) — so programmers use hexadecimal as a compact representation. Memory addresses, color codes in web development (like #FF5733), machine code instructions, and network packet data are all commonly expressed in hexadecimal. Octal was historically important in computing systems with word sizes divisible by 3 (such as 12-bit and 36-bit architectures) and still appears in Unix file permissions (chmod 755). Understanding these bases and their interrelationships is essential for programming, debugging, network analysis, cybersecurity, and any technical work involving the internal representation of digital data. Base64 encoding, used extensively in web applications and email, represents binary data using 64 different characters, demonstrating how number base concepts extend to practical data encoding problems.

Practical Example

Convert 255 (decimal) to binary: 255 ÷ 2 = 127 R 1, 127 ÷ 2 = 63 R 1, 63 ÷ 2 = 31 R 1, 31 ÷ 2 = 15 R 1, 15 ÷ 2 = 7 R 1, 7 ÷ 2 = 3 R 1, 3 ÷ 2 = 1 R 1, 1 ÷ 2 = 0 R 1. Reading remainders bottom-up: 11111111.

255 in hex: 255 ÷ 16 = 15 R 15, 15 ÷ 16 = 0 R 15. So FF in hex.

Frequently Asked Questions

What is hexadecimal used for?

Hexadecimal is used for memory addresses, color codes (like #FF5733), MAC addresses, and representing binary data compactly. One hex digit represents exactly 4 binary digits.

Why do computers use binary?

Computers use binary because electronic circuits have two stable states: on (1) and off (0). Transistors naturally represent binary digits, making binary the most reliable hardware implementation.

What is the highest practical number base?

Base-36 is the highest practical base using 0-9 and A-Z. Beyond that, you need multi-character digit representations. Base-64 is common for encoding but uses special characters.

How do I convert binary to hex quickly?

Group binary digits in sets of 4 from right to left, then convert each group to its hex equivalent. Example: 11111111 → 1111 1111 → F F = FF.

What is two's complement?

Two's complement is a way to represent negative numbers in binary. To negate a number, invert all bits and add 1. The leftmost bit indicates sign: 0 = positive, 1 = negative.

Disclaimer: This converter handles integers. Verify critical conversions independently.

References

  1. Wikipedia. "Radix." en.wikipedia.org
  2. Khan Academy. "Binary and hexadecimal number systems." khanacademy.org

Comments