Number Base Converter Explained: Decimal, Binary, Octal, Hexadecimal
ByMuhammad Ali•Founder of KruskalCode
22:19
6 min read

Understanding different number bases is crucial in many fields, especially computer science and digital electronics. While we use the Decimal (Base 10) system in our daily lives, computers operate using Binary (Base 2). Octal (Base 8) and Hexadecimal (Base 16) provide more compact ways to represent these binary values. This guide will walk you through the concepts of number bases and how to convert between them, supported by our easy-to-use online Number Base Converter.
Explanation
Every number system has a base, which determines the number of unique digits (including zero) used to represent numbers. For instance, in Base 10 (decimal), we use ten digits (0-9). In Base 2 (binary), we only use two digits (0 and 1). The position of each digit in a number represents a power of the base. For example, in decimal, the number 123 means 1*10^2 + 2*10^1 + 3*10^0. The same principle applies to other bases, just with a different base value. Converting from any base to decimal involves multiplying each digit by the base raised to the power of its position and summing the results. Converting from decimal to another base typically involves repeated division by the target base, collecting the remainders in reverse order.
Formula
To convert from Base B to Decimal:
Number = (d_n * B^n) + (d_{n-1} * B^{n-1}) +. + (d_1 * B^1) + (d_0 * B^0) To convert from Decimal to Base B:
1. Divide the decimal number by B. 2. Record the remainder. 3. Replace the decimal number with the quotient. 4. Repeat until the quotient is 0. 5. The new number in Base B is the sequence of remainders, read from bottom to top.Example
Let's convert the hexadecimal number '1A' to its decimal equivalent. Here, the base B is 16. The digits are 1 and A (which represents 10 in decimal). Position 1 (leftmost): 1 * 16^1 = 1 * 16 = 16 Position 0 (rightmost): A (10) * 16^0 = 10 * 1 = 10 Summing these: 16 + 10 = 26. So, 1A (hexadecimal) is equal to 26 (decimal).
How to use the related calculator
Using our Number Base Converter is straightforward. First, enter the number you wish to convert into the 'Number to Convert' field. Next, select its current base from the 'From Base' dropdown menu. Finally, choose the desired target base from the 'To Base' dropdown. Click 'Calculate' (or similar button) to instantly see the converted result. The tool will display both your input and the converted number, clearly labeled with their respective bases.
Try the related calculator
Open toolFAQ
What is the difference between decimal, binary, octal, and hexadecimal?
Decimal (Base 10) uses digits 0-9. Binary (Base 2) uses 0-1. Octal (Base 8) uses 0-7. Hexadecimal (Base 16) uses 0-9 and letters A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Each system has a different number of unique symbols to represent values.
Why is hexadecimal used in computing?
Hexadecimal is often used because it can represent 4 bits of binary data with a single digit (since 16 = 2^4). This makes long binary strings much shorter and easier for programmers to read and write, especially when dealing with memory addresses, color codes, or data values.
Can I convert negative numbers or fractions with this tool?
Our current Number Base Converter is designed for positive whole numbers (integers) only. Converting negative numbers or numbers with fractional parts (like 10.5) requires additional rules and methods beyond the scope of this tool.
Related articles

About the author
Muhammad Ali. Muhammad Ali is a full-stack developer and founder of KruskalCode. He builds SaaS platforms and automation systems with React and Laravel, and helps teams ship fast, scalable tools.
Need a custom calculator, dashboard, or automation workflow? Reach out to KruskalCode.