Base Converter

Base Converter — Convert Numbers Between Any Radix Online

This free base converter lets you instantly translate numbers between binary, octal, decimal, hexadecimal, and any custom radix from 2 to 36. Whether you are a software engineer debugging memory addresses, a computer science student learning number systems, or an electronics hobbyist reading datasheets, this number base conversion tool delivers accurate results in real time. All calculations run entirely in your browser with no data sent to any server and no account required.

Understanding Number Bases

A number base, also called a radix, defines how many unique digits a positional numeral system uses before carrying over to the next place. The base you encounter most often in everyday life is base 10, the decimal system, which uses the digits 0 through 9. Humans likely adopted base 10 because we have ten fingers, making it a natural counting framework. However, decimal is far from the only useful base. Computers, mathematicians, and engineers rely on several alternative bases every day, each chosen because it maps cleanly onto a particular domain.

Base 2, known as binary, is the foundation of all digital computing. Every processor, memory chip, and storage device ultimately represents information as sequences of ones and zeros. A single binary digit — a bit — corresponds to one of two electrical states: on or off, high voltage or low voltage. Groups of eight bits form a byte, which can represent 256 distinct values (0 to 255). Understanding binary is essential for anyone working with low-level programming, bitwise operations, network subnetting, or digital circuit design.

Base 8, or octal, groups binary digits into sets of three. Each octal digit maps to exactly three bits, which made octal popular in early computing when word sizes were multiples of three (such as 12-bit, 24-bit, or 36-bit architectures). Today, octal remains relevant primarily in Unix and Linux file permission systems, where the familiar chmod values like 755 or 644 are octal numbers that encode read, write, and execute permissions for owner, group, and others.

Base 16, called hexadecimal, groups binary digits into sets of four. Each hex digit represents exactly four bits, or one nibble, making it extremely compact for expressing binary data. Hexadecimal uses the digits 0-9 plus the letters A-F (where A equals 10 and F equals 15). You will encounter hex everywhere in software development: memory addresses, color codes in CSS and graphic design, MAC addresses in networking, Unicode code points, and raw byte dumps in debuggers. A single byte can be written as two hex digits, which is far more readable than eight binary digits.

Beyond these common bases, other radixes serve specialized purposes. Base 3 (ternary) appears in balanced ternary computing research and certain mathematical puzzles. Base 12 (duodecimal) has advocates who argue it divides more evenly than base 10, since 12 is divisible by 2, 3, 4, and 6. Base 36 uses all ten digits plus all 26 letters of the Latin alphabet, providing the maximum radix achievable with standard alphanumeric characters. It is often used for generating compact, human-readable identifiers in URLs and database keys. Base 60 (sexagesimal), inherited from ancient Babylonian mathematics, still shapes how we measure time (60 seconds in a minute, 60 minutes in an hour) and angles (360 degrees in a circle).

Understanding Radix Systems

A radix system is a positional notation where the value of each digit depends on its position within the number. In any base-b system, the rightmost digit represents b0 (which is always 1), the next digit to the left represents b1, the next represents b2, and so on. The total value of the number is the sum of each digit multiplied by its positional weight.

Consider the decimal number 4073. In base 10, this breaks down as: 4 × 103 + 0 × 102 + 7 × 101 + 3 × 100 = 4000 + 0 + 70 + 3 = 4073. The same positional logic applies to every other base. In hexadecimal, the number 2F5 means: 2 × 162 + F × 161 + 5 × 160 = 512 + 240 + 5 = 757 in decimal.

The radix converter on this page automates these positional calculations for you. You simply enter a number in one base, specify the source radix and the target radix, and the tool computes the equivalent representation instantly. This eliminates the tedious manual arithmetic that is especially error-prone with large numbers or unfamiliar bases.

One important concept in radix systems is that the same sequence of digits can represent completely different values depending on the base. The string "100" equals 4 in binary, 8 in octal, 64 in base 8, 100 in decimal, and 256 in hexadecimal. This is why it is critical to always specify the base when writing numbers in technical documentation. Common conventions include prefixes like 0b for binary (0b1010), 0o for octal (0o17), and 0x for hexadecimal (0xFF), or subscript notation like 10102 and FF16.

Fractional numbers also work in non-decimal bases, though they can behave unexpectedly. Just as 1/3 produces the repeating decimal 0.333... in base 10, many simple fractions produce repeating expansions in other bases. For instance, 0.1 in decimal (one-tenth) becomes the infinitely repeating binary fraction 0.0001100110011... This is the root cause of floating-point precision issues that every programmer eventually encounters. Understanding radix systems helps you reason about why 0.1 + 0.2 does not equal exactly 0.3 in most programming languages.

How the Base Conversion Works

Converting a number from one base to another is a two-step process. First, you interpret the source number in its original base and compute its value in base 10 (decimal). Second, you take that decimal value and express it in the target base using repeated division. This base converter performs both steps automatically, but understanding the underlying mechanics helps you verify results and build intuition about how number systems relate to each other.

For common conversions, we also offer dedicated single-purpose tools. If you need to go straight from decimal to binary notation, that focused converter provides additional context specific to binary output. Similarly, our decimal to hexadecimal converter is tailored for developers who work primarily with hex values in code and design. For the reverse direction, the hex to decimal conversion tool is optimized for reading hardware registers and memory dumps. You can also jump directly between non-decimal bases using our hex to binary converter, which is especially handy for bit-level analysis of hexadecimal data.

When working with color values in web development, hexadecimal plays a central role. If you need to break a hex color code into its red, green, and blue components, our hex to RGB color converter handles that specific workflow. And for encoding raw bytes into hexadecimal strings for transport or storage, the hex encoding tool provides a streamlined interface.

Conversion Formula

The general formula for converting a number from base b to decimal is:

Value = dn × bn + dn-1 × bn-1 + ... + d1 × b1 + d0 × b0

Here, di represents the digit at position i (counting from the right, starting at zero), and b is the base. Each digit is multiplied by the base raised to the power of its position, and all the products are summed to produce the decimal equivalent.

Let us walk through a concrete example. To convert the binary number 11010110 to decimal: 1×27 + 1×26 + 0×25 + 1×24 + 0×23 + 1×22 + 1×21 + 0×20 = 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = 214. So binary 11010110 equals decimal 214.

To convert from decimal to another base, you use repeated division. Divide the decimal number by the target base, record the remainder, then divide the quotient by the target base again. Repeat until the quotient reaches zero. The remainders, read in reverse order (from last to first), form the number in the target base.

For example, to convert decimal 214 to hexadecimal: 214 ÷ 16 = 13 remainder 6, then 13 ÷ 16 = 0 remainder 13. Reading the remainders in reverse gives D6 (since 13 maps to the letter D in hex). Therefore, decimal 214 equals hexadecimal D6. You can verify this: D × 16 + 6 = 13 × 16 + 6 = 208 + 6 = 214.

For direct base-to-base conversion without going through decimal, you can use grouping shortcuts when the bases are powers of each other. Since 16 = 24, each hexadecimal digit corresponds to exactly four binary digits. To convert binary to hex, simply group the binary digits into sets of four from right to left and replace each group with its hex equivalent. For 11010110: split into 1101 and 0110, which map to D and 6, giving D6. This shortcut also works between binary and octal (groups of three) and between octal and hexadecimal (via binary as an intermediate).

Horner's method provides a computationally efficient alternative for base-to-decimal conversion. Instead of computing each power of the base separately, you process digits from left to right using the recurrence: start with 0, then for each digit, multiply the running total by the base and add the current digit. For binary 11010110: ((((((1×2+1)×2+0)×2+1)×2+0)×2+1)×2+1)×2+0 = 214. This method avoids computing large powers and is how most software implementations actually perform the conversion internally.

Practical Applications

Number base conversion is not just an academic exercise — it is a daily necessity across many technical disciplines. Here are the most common real-world scenarios where you will need a base converter.

Software development and debugging. Programmers constantly switch between decimal, hexadecimal, and binary when working with low-level code. Memory addresses in debuggers are displayed in hex. Bitwise operations in languages like C, Java, and Python require thinking in binary. Color values in CSS use hex notation. Error codes in system logs are often hexadecimal. A reliable number base conversion tool saves time and prevents mistakes during these workflows.

Networking and system administration. IP addresses, subnet masks, and MAC addresses all involve base conversions. An IPv4 address like 192.168.1.1 is actually four decimal numbers that each represent an 8-bit binary value. Subnet calculations require converting these octets to binary to determine network and host portions. MAC addresses are written as six pairs of hexadecimal digits. Network engineers use our binary to decimal converter frequently when working with subnet masks and CIDR notation.

Digital electronics and hardware design. Engineers designing circuits, FPGAs, and microcontrollers work extensively with binary and hexadecimal. Register values, bus widths, address spaces, and instruction opcodes are all expressed in these bases. When reading datasheets or programming hardware registers, converting between hex and binary is a constant task. The grouping relationship between hex and binary (each hex digit equals four bits) makes hexadecimal the preferred shorthand for binary data in hardware documentation.

Computer science education. Students learning about data representation, computer architecture, and algorithms need to practice base conversions regularly. Understanding how numbers are stored in memory, how floating-point arithmetic works, and how character encodings function all require fluency in multiple number bases. This base converter serves as both a learning aid and a verification tool for homework and exam preparation.

Cryptography and security. Hash values, encryption keys, digital signatures, and certificates are typically displayed in hexadecimal. A SHA-256 hash, for instance, is a 64-character hex string representing 256 bits of data. Security professionals need to convert between hex and binary when analyzing cryptographic outputs, examining packet captures, or verifying file integrity checksums.

Data science and encoding. Base conversions appear in data encoding schemes like Base64 (used for embedding binary data in text formats like JSON and email), Base32 (used in TOTP two-factor authentication codes), and Base58 (used in Bitcoin addresses to avoid visually ambiguous characters). Understanding the underlying radix arithmetic helps you work with these encoding systems more effectively.

Game development. Game developers encounter hex values in color palettes, tile map editors, memory-mapped I/O for retro console development, and cheat code systems. ROM hackers and modders frequently need to read and modify hexadecimal data in binary files. The ability to quickly convert between bases is an essential skill in this domain.

Number Base Reference Table

The following table shows how the decimal numbers 0 through 31 are represented in binary (base 2), octal (base 8), and hexadecimal (base 16). This reference is useful for quick lookups and for building familiarity with how values map across the most commonly used number bases in computing.

Decimal (Base 10)Binary (Base 2)Octal (Base 8)Hexadecimal (Base 16)
0000
1111
21022
31133
410044
510155
611066
711177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
16100002010
17100012111
18100102212
19100112313
20101002414
21101012515
22101102616
23101112717
24110003018
25110013119
2611010321A
2711011331B
2811100341C
2911101351D
3011110361E
3111111371F

Notice the key patterns in this table. Binary representations grow quickly in length — the number 31 requires five binary digits but only two hex digits. Octal rolls over to two digits at 8, while hexadecimal does not roll over until 16. These patterns reflect the fundamental relationship between the bases: hex is more compact because it packs more information per digit. The first 16 rows (0 through 15) are especially important to memorize if you work with hex regularly, since every hex digit maps to one of these four-bit binary patterns.

Frequently Asked Questions

What is a number base and why does it matter?

A number base (also called a radix) is the number of unique digits used in a positional numeral system. The base determines how place values increase as you move left through a number. Base 10 uses digits 0-9 and each position is worth ten times the position to its right. Base 2 uses only 0 and 1, with each position worth twice the previous one. Number bases matter because different domains use different bases for practical reasons. Computers operate in binary because digital circuits have two states. Programmers use hexadecimal because it compactly represents binary data. Understanding bases lets you work fluently across these domains and interpret data correctly regardless of how it is represented.

How do I convert a decimal number to binary?

To convert a decimal number to binary manually, use the repeated division method. Divide the decimal number by 2 and write down the remainder (which will be either 0 or 1). Then divide the quotient by 2 again and record the new remainder. Continue this process until the quotient reaches zero. Finally, read the remainders from bottom to top — that sequence is the binary representation. For example, to convert decimal 45 to binary: 45 divided by 2 is 22 remainder 1, then 22 divided by 2 is 11 remainder 0, then 11 divided by 2 is 5 remainder 1, then 5 divided by 2 is 2 remainder 1, then 2 divided by 2 is 1 remainder 0, then 1 divided by 2 is 0 remainder 1. Reading the remainders from last to first gives 101101. So decimal 45 equals binary 101101. You can verify this with our decimal to binary converter or use this general-purpose base converter by setting the source base to 10 and the target base to 2.

How do I convert hexadecimal to decimal?

To convert a hexadecimal number to decimal, multiply each hex digit by 16 raised to the power of its position (counting from zero on the right) and sum all the results. Remember that hex digits A through F represent the decimal values 10 through 15. For example, to convert hex 3FA to decimal: F is in position 1 and A is in position 0, so the calculation is 3 × 162 + 15 × 161 + 10 × 160 = 768 + 240 + 10 = 1018. Therefore, hexadecimal 3FA equals decimal 1018. This conversion comes up constantly when reading memory addresses, analyzing network packets, or interpreting color codes. For large hex values, using this base converter or our dedicated hex to decimal conversion tool is much faster and less error-prone than manual calculation.

Why do programmers use hexadecimal instead of binary?

Programmers prefer hexadecimal over binary because it is far more compact and readable while still maintaining a direct, clean mapping to binary. Each hexadecimal digit represents exactly four binary digits (bits), so a single byte that requires eight binary digits can be written as just two hex digits. For example, the binary value 11111111 is simply FF in hex, and the 32-bit address 11000000101010000000000100000001 becomes C0A80101 — much easier to read, type, and remember. Since 16 is a power of 2, converting between hex and binary is trivial: you just substitute each hex digit with its four-bit equivalent. This makes hexadecimal the ideal human-readable shorthand for binary data. You get the compactness of a higher base without losing the ability to quickly reason about individual bits when needed.

What is the difference between binary, octal, and hexadecimal?

Binary (base 2), octal (base 8), and hexadecimal (base 16) are all positional number systems used in computing, but they differ in how many digits they use and how compactly they represent data. Binary uses only two digits (0 and 1) and is the native language of digital hardware. Octal uses eight digits (0 through 7) and groups binary digits into sets of three — it was historically popular with older computer architectures and is still used for Unix file permissions. Hexadecimal uses sixteen digits (0-9 and A-F) and groups binary digits into sets of four, making it the most compact of the three for representing binary data. A single byte (8 bits) requires eight characters in binary, three characters in octal, but only two characters in hex. All three bases are powers of 2, which is why they convert to and from binary so cleanly. The choice between them depends on context: binary for bit-level operations, octal for file permissions, and hex for most other programming and hardware tasks.

Can I convert negative numbers between bases?

Yes, but the approach depends on the representation you are using. For simple signed magnitude, you convert the absolute value normally and then prepend a minus sign. For example, decimal -42 in binary signed magnitude is -101010. However, computers typically represent negative integers using two's complement notation, which avoids the ambiguity of having both positive and negative zero. In two's complement, a negative number is formed by inverting all the bits of its positive counterpart and adding 1. For instance, in an 8-bit system, decimal 42 is 00101010 in binary. To get -42, invert to 11010101 and add 1, yielding 11010110. The leading bit (called the sign bit) indicates whether the number is positive (0) or negative (1). When converting two's complement numbers between bases, it is important to know the bit width, because the same binary pattern can represent different values depending on whether it is interpreted as an 8-bit, 16-bit, or 32-bit number. This base converter handles unsigned integers; for two's complement conversions, first determine the unsigned decimal equivalent and then convert.

What is the highest base this converter supports?

This base converter supports radixes from 2 (binary) up to 36. Base 36 is the practical maximum for systems that use the standard set of alphanumeric characters: the ten digits 0 through 9 plus the twenty-six letters A through Z. In base 36, the digit A represents 10, B represents 11, and so on up to Z representing 35. Bases higher than 36 are theoretically possible but would require additional symbols beyond the standard Latin alphanumeric set, which creates readability and input challenges. Base 36 is commonly used in practice for generating short, URL-safe identifiers — for example, converting a large integer like a database primary key into a compact alphanumeric string. Some systems use Base58 (which excludes visually ambiguous characters like 0, O, I, and l) or Base62 (which adds lowercase letters as distinct from uppercase), but these require custom digit sets beyond the conventional single-character-per-digit approach.

How are number bases used in web development?

Number bases appear throughout web development in several important ways. The most visible use is hexadecimal color codes in CSS — values like #FF5733 or #2C3E50 that define colors as three pairs of hex digits representing red, green, and blue intensity from 00 (0) to FF (255). Understanding hex lets you tweak colors directly in code without needing a color picker. Beyond colors, web developers encounter hex in Unicode escape sequences (like \u00E9 for the character "e" with an accent), in data URIs that embed Base64-encoded images directly in HTML, in Content Security Policy hashes, and in debugging tools that display HTTP request and response bodies as hex dumps. JavaScript provides built-in methods for base conversion — parseInt("FF", 16) converts hex to decimal, and (255).toString(16) converts decimal to hex — making it straightforward to work with different bases programmatically. If you frequently work with hex color values, our hex to RGB number converter can help you quickly decompose color codes into their component channels.

Is there a quick way to convert between octal and hexadecimal?

There is no single-step shortcut for converting directly between octal and hexadecimal because 8 is not a power of 16 and 16 is not a power of 8. However, both bases are powers of 2, so the fastest manual method uses binary as an intermediate step. First, convert each octal digit to its three-bit binary equivalent. Then regroup the resulting binary string into sets of four bits from right to left (padding with leading zeros if necessary) and convert each four-bit group to its hex equivalent. For example, octal 375 becomes binary 011 111 101. Regrouping into four-bit sets gives 0111 1110 1, which with left-padding becomes 0000 1111 1101, or hex 0FD. In reverse, convert each hex digit to four bits, then regroup into three-bit sets for octal. This two-step process through binary is fast once you memorize the three-bit and four-bit lookup tables, which only have eight and sixteen entries respectively. For larger numbers, this base converter handles the conversion instantly and eliminates the chance of grouping errors.

FAQ

How does Base Converter work?

Convert numbers between any bases (2-36) instantly.

Ad