Number Base Converter
Last updated: 7 August 2026
Reviewed by Gavin Meiring, Lead research and primary author ยท Doctoral Candidate (Corporate Governance) ยท Research and drafting assisted by AI
- The Babylonians used base 60 around 4,000 years ago, and its legacy survives in our 60-minute hours and 360-degree circles.
- Computers work in binary (base 2), and hexadecimal (base 16) is a convenient shorthand because one hex digit represents exactly four bits.
- In decimal, 0.1 is a simple fraction, but in binary it is a repeating fraction โ the root cause of many floating-point rounding surprises in software.
Number Base Converter
A number base converter translates any number from one numeral system to another, including binary (base 2), octal (base 8), decimal (base 10), hexadecimal (base 16), and any other base from 2 to 36. It is an essential tool for computer science students, programmers, and electronics engineers who work across different number systems.
How to Use the Number Base Converter
- Enter the number you wish to convert in the input field.
- Select the base of the input number (for example, 16 for hexadecimal).
- Select the target base for the output.
- Click Convert to see the result along with a step-by-step conversion.
- Use the multi-base view to see the same value expressed in binary, octal, decimal, and hexadecimal simultaneously.
The Formula
To convert from any base B to decimal: multiply each digit by B raised to the power of its position (counting from right, starting at 0), then sum.
Decimal value = d(n) x B^n + d(n-1) x B^(n-1) + ... + d(0) x B^0
To convert from decimal to any base B: repeatedly divide by B and record the remainders. Read remainders from bottom to top.
To convert between two non-decimal bases: convert to decimal first, then from decimal to the target base.
Real-World Example
Convert hexadecimal FF to decimal and binary.
Step 1: FF (base 16) to decimal. F in hexadecimal = 15 in decimal. FF = 15 x 16^1 + 15 x 16^0 = 240 + 15 = 255.
Step 2: 255 (decimal) to binary. 255 / 2 = 127 remainder 1 127 / 2 = 63 remainder 1 63 / 2 = 31 remainder 1 31 / 2 = 15 remainder 1 15 / 2 = 7 remainder 1 7 / 2 = 3 remainder 1 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder 1
Read remainders upward: 11111111.
So hexadecimal FF = decimal 255 = binary 11111111.
Why Different Number Bases Are Used
Computers use binary (base 2) because digital circuits have two states: on and off, represented as 1 and 0. However, binary numbers for large values are long and difficult to read. Hexadecimal (base 16) uses digits 0-9 and letters A-F and provides a compact shorthand: each hex digit exactly represents four binary bits. This is why memory addresses, colour codes in web design (#FF5733), and machine code are commonly written in hexadecimal. Octal (base 8) was historically used in older computing systems and is still found in Unix file permission notation (chmod 755, for example). Base 64 is used to encode binary data in email attachments and data URLs. Understanding base conversion is fundamental to reading debugger output, writing low-level drivers, designing hardware, and working with network protocols.
Frequently Asked Questions
What digits are used in bases above 10? For bases greater than 10, letters of the alphabet are used to represent digit values above 9. Base 16 (hexadecimal) uses A=10, B=11, C=12, D=13, E=14, F=15. Higher bases continue with G=16, H=17, and so on up to Z=35, allowing number systems up to base 36.
Is hex the same as base 16? Yes, hexadecimal and base 16 are the same thing. The prefix "hex" means six, and "decimal" means ten: 6+10=16 digits total (0-9 plus A-F). It is the most common non-decimal base used in computing and is often denoted by the prefix 0x (for example, 0xFF in source code).
What is the largest base I can convert to? This tool supports bases from 2 to 36, covering all cases that can be represented using digits 0-9 and letters A-Z. Bases above 36 require additional symbols and are rarely encountered in practical computing or mathematics.
How do I convert a number with a fractional part? The integer part converts using division and remainders as normal. The fractional part is converted by repeatedly multiplying by the target base and taking the integer part of each product. Note that fractions that terminate cleanly in one base (like 0.1 in decimal) may produce repeating digits in another base (0.1 in decimal is a repeating fraction in binary).
One value written in five bases
The same quantity looks different in each system, and the table below puts four of them side by side with base 36, the last base the digit set can reach.
| Decimal | Binary, base 2 | Octal, base 8 | Hexadecimal, base 16 | Base 36 |
|---|---|---|---|---|
| 255 | 11111111 | 377 | FF | 73 |
| 493 | 111101101 | 755 | 1ED | DP |
| 1295 | 10100001111 | 2417 | 50F | ZZ |
| 1296 | 10100010000 | 2420 | 510 | 100 |
| 2026 | 11111101010 | 3752 | 7EA | 1KA |
Reading down a column, the pattern that the base sets: binary words grow by roughly three digits for every one digit added in octal, because each octal digit carries three bits, and by exactly four digits for every two digits in hexadecimal, because each hex digit carries four bits. Base 36 packs the most value into the fewest characters, which is why short codes in URLs and licence keys are often written in it.
The arithmetic behind a hex colour code
A web colour such as #FF5733 carries three byte values written in hexadecimal, and the conversion back to decimal can be done in one line each.
FF = 15 x 16 + 15 = 240 + 15 = 255
57 = 5 x 16 + 7 = 80 + 7 = 87
33 = 3 x 16 + 3 = 48 + 3 = 51
So #FF5733 is the same colour as rgb(255, 87, 51), an orange-red. The two-digit pairs are not an arbitrary grouping: a hex digit is four bits, a nibble, so two of them make exactly one byte, and a byte holds a range of 0 to 255. Every colour channel in the web format is one byte for that reason.
The same decomposition explains Unix file permissions. The mode 755 takes each octal digit as three bits.
7 = 111, so read, write and execute for the owner
5 = 101, so read and execute, but not write, for the group
5 = 101, so the same again for everyone else
Concatenated, those nine bits are 111101101, which is 493 in decimal. The octal form survives because it shows the three permission groups as three characters, which the decimal form does not.
Why the digit set stops at base 36
Base conversion past ten needs symbols for the values above nine, and the convention everywhere in computing is the alphabet: A carries 10, B carries 11, and the sequence runs to Z carrying 35.
| Digit | Value | Digit | Value |
|---|---|---|---|
| 0 to 9 | 0 to 9 | P | 25 |
| A | 10 | Q | 26 |
| B | 11 | R | 27 |
| F | 15 | V | 31 |
| G | 16 | Z | 35 |
The largest single digit is therefore 35, and the largest base that can be written with one character per position is 36. Two boundary cases show where that leaves the system. In base 36 the value 1295 is ZZ, because 35 times 36 plus 35 comes to 1295, and it is the last two-character number the base can express. The next integer, 1296, is 100, because 36 squared is 1296. A base above 36 would need a symbol for 36, and no agreed one exists.
Converting a decimal to another base by division
The method is a loop of divisions, reading the remainders in reverse. Take 493 and convert it to octal.
493 divided by 8 = 61 remainder 5
61 divided by 8 = 7 remainder 5
7 divided by 8 = 0 remainder 7
Read the remainders from the bottom up and the answer is 755. The check runs the other way: 7 times 64 is 448, 5 times 8 is 40, and the last 5 is a unit, giving 448 plus 40 plus 5, which is 493. The conversion to hexadecimal works identically with a divisor of 16, and it yields 1ED, because 1 times 256 plus 14 times 16 plus 13 comes to 493.
What happens to the part after the point
An integer converts exactly in either direction. A fraction often does not, because the two bases divide the line up differently.
Take decimal 0.1 in binary. The fractional conversion multiplies by the target base repeatedly and takes the integer part each time, and in binary that produces the repeating sequence 0001100110011 and never terminates, in the same way that one third never terminates in decimal. A computer stores the nearest binary value it can, which for the standard double precision format is 0.1000000000000000055511151231257827, a little above one tenth. The residue shows up when the values are added: 0.1 plus 0.2 in double precision evaluates to 0.30000000000000004 rather than 0.3.
That is a property of the storage format and not an error in the conversion. The practical consequence is that a round trip through a fractional value can return a number that differs in the last digits, so a comparison that expects exact equality on a fractional value is worth replacing with a tolerance.
How many values each width holds
| Width | Distinct patterns | Largest unsigned value | Hex digits needed |
|---|---|---|---|
| 8 bits | 256 | 255 | 2 |
| 16 bits | 65,536 | 65,535 | 4 |
| 32 bits | 4,294,967,296 | 4,294,967,295 | 8 |
| 64 bits | 18,446,744,073,709,551,616 | 18,446,744,073,709,551,615 | 16 |
Each width holds twice as many patterns as the width below it. The largest value at a given width is one less than the count, because the count includes zero, which is the detail behind the familiar pair of 255 and 256 in colour and byte work.
Method and the limits of the conversion
Four points bound what a base conversion can do.
Integers convert exactly and reversibly. A whole number written in base 2 and read back in base 36 and converted again returns the original value with nothing lost, because every base is a complete positional notation for whole numbers.
Fractions generally do not. A fraction terminates in one base only when the denominator, in lowest terms, divides some power of that base, which decimal and binary satisfy for different denominators. Where the output of a conversion shows a stopping point, that stopping point is a rounding decision.
Bases stop at 36 for the reason given above, and the conversion is case-insensitive in practice: a lowercase a and an uppercase A carry the same value of ten, and tools normalise the case on output.
A base conversion is not a sign convention. Writing a negative number in base 16 is not the same as writing its two's complement binary form, and the two are easy to confuse in low-level work. The digits represent magnitude, and how the sign is carried is a separate agreement that the conversion itself does not supply.
Also try these free tools: