Base Converter — Free Online Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal, and any custom base from 2 to 36 with instant results and step-by-step explanations.
Result
Base 10 → Base 2
Conversion Steps
Convert 255 (decimal) to base 2: 11111111
All Common Bases
How to Use the Base Converter
- Enter the number: Type the number you want to convert in the input field. Use only valid digits for the selected source base. For binary, use 0 and 1 only. For hexadecimal, use 0-9 and A-F. The input is case-insensitive for letter digits.
- Select the source base: Choose the base of the number you entered from the "From Base" dropdown. Common options include binary (2), octal (8), decimal (10), and hexadecimal (16). For other bases, select "Custom Base" and enter any value from 2 to 36.
- Select the target base: Choose the base you want to convert to from the "To Base" dropdown. This supports the same common bases and custom option as the source.
- Review the results: The main result shows your number in the target base. Below that, the conversion steps explain the intermediate decimal conversion if applicable. The "All Common Bases" section shows the number in bases 2, 8, 10, 16, 32, and 36 simultaneously, which is useful for quick cross-reference.
The conversion happens in real time as you type. If the input contains invalid digits for the selected base (like the digit 3 in binary), the result area will indicate invalid input. This helps you quickly correct any mistakes.
Base Conversion Formulas
Any Base to Decimal
Value = d_n × b^n + d_(n-1) × b^(n-1) + ... + d_0 × b^0 Decimal to Any Base
Repeatedly divide by target base, record remainders in reverse Any Base to Any Base
Step 1: Convert to decimal | Step 2: Convert decimal to target Variables Explained
- b (Base/Radix): The number of unique digits in the number system. Decimal has base 10, binary has base 2, and hexadecimal has base 16. The base determines the positional value of each digit.
- d (Digit): Each position in a number holds a digit value from 0 to (base - 1). In hexadecimal, digits include 0-9 and A-F (where A=10 through F=15). In base 36, digits extend through Z=35.
- n (Position): The position of each digit, counted from right to left starting at 0. The rightmost digit is at position 0, the next at position 1, and so on. Each position represents b^n in value.
Step-by-Step Example
Convert 1A3 from hexadecimal (base 16) to binary (base 2):
- Convert each hex digit to decimal: 1=1, A=10, 3=3
- Calculate decimal value: 1 × 16^2 + 10 × 16^1 + 3 × 16^0 = 256 + 160 + 3 = 419
- Convert 419 to binary by repeated division: 419/2=209 r1, 209/2=104 r1, 104/2=52 r0, 52/2=26 r0, 26/2=13 r0, 13/2=6 r1, 6/2=3 r0, 3/2=1 r1, 1/2=0 r1
- Read remainders from bottom to top: 110100011
Alternatively, you can convert each hex digit directly to its 4-bit binary equivalent: 1=0001, A=1010, 3=0011, giving 000110100011 or 110100011 without leading zeros. This shortcut works because 16 is a power of 2.
Practical Examples
Example 1: Web Developer Color Code Conversion
Tom, a web developer, needs to understand the RGB values of the CSS color #3CB371 (Medium Sea Green). He uses the base converter to convert each hex pair to decimal:
- Red: 3C (hex) = 3 × 16 + 12 = 60 (decimal)
- Green: B3 (hex) = 11 × 16 + 3 = 179 (decimal)
- Blue: 71 (hex) = 7 × 16 + 1 = 113 (decimal)
So #3CB371 equals RGB(60, 179, 113). Understanding this conversion helps Tom adjust colors programmatically and communicate precise color values to designers who may prefer decimal notation.
Example 2: Networking IP Address Analysis
Aisha, a network engineer, needs to calculate the subnet mask for a /20 CIDR network. She knows the subnet mask has 20 ones followed by 12 zeros in binary. Using the converter to convert each octet:
- First octet: 11111111 (binary) = 255 (decimal)
- Second octet: 11111111 (binary) = 255 (decimal)
- Third octet: 11110000 (binary) = 240 (decimal)
- Fourth octet: 00000000 (binary) = 0 (decimal)
The subnet mask is 255.255.240.0. Binary-to-decimal conversion is essential in networking for subnetting, CIDR calculations, and understanding IP addressing schemes.
Example 3: Computer Science Homework
Kevin, a computer science student, needs to convert the decimal number 1000 to bases 2, 8, and 16 for an assignment. Using the base converter:
- Decimal 1000 → Binary: 1111101000
- Decimal 1000 → Octal: 1750
- Decimal 1000 → Hexadecimal: 3E8
Kevin can verify each conversion by converting back to decimal. 3E8 in hex = 3 × 256 + 14 × 16 + 8 = 768 + 224 + 8 = 1000. The "All Common Bases" feature shows all conversions simultaneously, saving time on multi-base assignments. For handling numbers in word form, try our number to words converter.
Example 4: Unix File Permissions
Laura, a system administrator, sets file permissions using chmod 755 and needs to understand what each digit means. She converts each octal digit to binary:
- Owner (7): 111 in binary = read + write + execute
- Group (5): 101 in binary = read + execute
- Others (5): 101 in binary = read + execute
Each octal digit represents a 3-bit binary value encoding read (4), write (2), and execute (1) permissions. Understanding octal-to-binary conversion is essential for Unix and Linux system administration.
Base Conversion Reference Table
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 1024 | 10000000000 | 2000 | 400 |
Tips and Complete Guide
Quick Binary-Hex Conversion Shortcut
Because hexadecimal base 16 is 2^4, each hex digit maps exactly to four binary digits. Memorize the 16 mappings (0=0000, 1=0001, ... 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111) and you can convert instantly between hex and binary without going through decimal. Group binary digits in sets of four from right to left for binary-to-hex. This is the fastest way to read memory dumps, analyze network packets, or debug machine code.
Powers of Two Every Programmer Should Know
Knowing key powers of 2 accelerates base conversion and programming: 2^8 = 256 (one byte), 2^10 = 1,024 (1 KB), 2^16 = 65,536, 2^20 = 1,048,576 (1 MB), 2^32 = 4,294,967,296 (max 32-bit unsigned integer), and 2^64 = 18,446,744,073,709,551,616 (max 64-bit unsigned integer). These values appear constantly in memory allocation, data type limits, array sizing, and performance optimization. For scientific number representation, see our scientific notation calculator.
Base Conversion in Real Applications
Beyond computer science, base conversion appears in many areas. ISBN numbers use a base-11 check digit. Airline booking codes use base 36 (0-9, A-Z). Ancient Babylonians used base 60, which is why we have 60 seconds in a minute and 60 minutes in an hour. The Mayan civilization used base 20. Understanding different bases provides insight into both modern technology and the history of mathematics.
Common Mistakes to Avoid
- Using invalid digits for the base: Each base only allows digits from 0 to (base-1). Binary only uses 0 and 1 — the digit 2 is invalid in binary. Octal uses 0-7 — the digits 8 and 9 are invalid. Always verify your input digits are valid for the source base.
- Confusing the direction of conversion: When converting binary to hex, group digits from right to left, not left to right. 10110 grouped as 1-0110 gives 16 in hex, but incorrectly grouped as 1011-0 gives B0, which is wrong.
- Forgetting that hex letters represent numbers: In hexadecimal, A=10, B=11, C=12, D=13, E=14, F=15. The hex number "10" equals decimal 16, not decimal 10. This confusion is especially common for beginners.
- Ignoring case sensitivity: While most systems treat hex letters as case-insensitive (A=a=10), some contexts are case-sensitive. Our converter accepts both cases, but be consistent in your own notation.
- Dropping leading zeros: When converting hex to binary for bitwise operations, maintaining leading zeros in each 4-bit group (0001 instead of just 1) ensures proper alignment and prevents bit-shifting errors.
Frequently Asked Questions
A number base (or radix) determines how many unique digits are used to represent numbers. Base 10 (decimal) uses digits 0-9 and is the standard in everyday life, likely because humans have 10 fingers. Base 2 (binary) uses only 0 and 1 and is fundamental to computers because digital circuits operate with two states (on/off). Base 16 (hexadecimal) uses 0-9 and A-F and is used in programming because it provides a compact representation of binary data. Base 8 (octal) uses 0-7 and was historically used in computing. Our base converter supports any base from 2 to 36.
To convert a decimal number to binary, repeatedly divide by 2 and record the remainders in reverse order. For example, to convert 42 to binary: 42 / 2 = 21 remainder 0, 21 / 2 = 10 remainder 1, 10 / 2 = 5 remainder 0, 5 / 2 = 2 remainder 1, 2 / 2 = 1 remainder 0, 1 / 2 = 0 remainder 1. Reading the remainders from bottom to top: 101010. So 42 in decimal equals 101010 in binary. Our converter does this instantly and also shows the value in all other common bases simultaneously.
To convert hexadecimal to decimal, multiply each digit by its positional power of 16 and sum the results. The digits A-F represent values 10-15. For example, to convert 2F3 from hex to decimal: 2 × 16^2 + F(15) × 16^1 + 3 × 16^0 = 2 × 256 + 15 × 16 + 3 × 1 = 512 + 240 + 3 = 755. So 2F3 in hexadecimal equals 755 in decimal. Our converter handles hexadecimal digits (A-F) in both uppercase and lowercase.
The four most commonly used bases are: Base 2 (binary) used in all digital electronics and computer science; Base 8 (octal) used in Unix file permissions and some legacy systems; Base 10 (decimal) used in everyday mathematics, commerce, and human-readable numbers; and Base 16 (hexadecimal) used in programming for memory addresses, color codes (like #FF5733), MAC addresses, and representing binary data compactly. Other bases like Base 36 (using 0-9 and A-Z) appear in URL shorteners and compact encoding schemes.
In web development, hexadecimal is widely used for color codes. CSS colors like #FF0000 (red), #00FF00 (green), and #0000FF (blue) represent RGB values in hexadecimal. Each pair of hex digits represents an intensity from 0 (00) to 255 (FF) for red, green, and blue channels. Hexadecimal is also used in Unicode character encoding (like U+0041 for the letter A), in URL encoding (like %20 for a space), and for representing binary data in debugging tools and memory viewers.
Yes, our converter supports any base from 2 to 36. Bases higher than 10 use letters to represent digits beyond 9: A=10, B=11, C=12, continuing through Z=35 for base 36. Base 36 is the highest commonly used base because it uses all 10 digits (0-9) plus all 26 letters (A-Z). Higher bases would require non-standard symbols. Base 36 appears in URL shorteners, product serial numbers, and compact encoding schemes where maximum information density in alphanumeric characters is desired.
Binary is fundamental to computing because digital circuits operate using two voltage states: high (1) and low (0). All data in computers, including text, images, audio, and video, is ultimately stored and processed as sequences of binary digits (bits). Eight bits form a byte, which can represent 256 values (0-255). Understanding binary helps in programming, networking (IP addresses), data compression, cryptography, and debugging. Even though programmers rarely write raw binary, they frequently use hexadecimal as a compact shorthand for binary values.
Binary, octal, and hexadecimal are closely related because 8 and 16 are powers of 2. Each octal digit represents exactly 3 binary digits: 7 in octal = 111 in binary. Each hexadecimal digit represents exactly 4 binary digits: F in hex = 1111 in binary. This makes conversion between these bases extremely fast. For example, the binary number 11010110 can be grouped as 11-010-110 for octal (326) or 1101-0110 for hex (D6). This direct mapping is why programmers prefer hex for reading binary data, as it is four times more compact than binary.
Related Calculators
Scientific Notation Calculator
Convert numbers to and from scientific notation with arithmetic operations.
Roman Numeral Converter
Convert between Roman numerals and decimal numbers with step-by-step breakdown.
Number to Words Converter
Convert any number into English words with ordinal support.
Percentage Calculator
Calculate percentages instantly with five different operation modes.
Scientific Calculator
Advanced calculations with trigonometry, logarithms, and scientific functions.
Ohm's Law Calculator
Calculate voltage, current, resistance, and power in electrical circuits.
Disclaimer: This calculator is for informational and educational purposes only. Results are estimates and may not reflect exact values.
Last updated: February 23, 2026
Sources
- Khan Academy — Number Systems: khanacademy.org
- NIST — Digital Computing Standards: nist.gov
- Mozilla Developer Network — CSS Color Values: developer.mozilla.org