Convert numbers between binary, decimal, hexadecimal, and octal bases instantly. Perfect for programmers, computer science students, and anyone working with different number systems.
Binary (Base 2): Uses digits 0-1
Octal (Base 8): Uses digits 0-7
Decimal (Base 10): Uses digits 0-9
Hexadecimal (Base 16): Uses digits 0-9 and A-F
A number base converter transforms numbers from one numeral system (base) to another. Different number bases are used in computing and mathematics, with binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) being the most common. Understanding and converting between these bases is essential for programming, computer science, digital electronics, and low-level system operations.
Our free Number Base Converter makes it easy to convert between any of these bases. Simply enter your number, select the input base, and instantly see conversions to all other bases. The tool validates input, provides real-time conversion, and allows you to copy results with one click, making it perfect for quick conversions during programming or debugging.
Different number bases serve different purposes in computing. Binary is the fundamental language of computers, representing data as 0s and 1s. Hexadecimal provides a more compact way to represent binary data, making it easier to read and write. Octal was historically used in computing and is still used in some Unix/Linux file permissions. Decimal is the standard human-readable number system. Converting between bases is essential for understanding how computers store and process data.
Programmers frequently need to convert between bases when working with memory addresses, color codes, file permissions, bitwise operations, network protocols, and low-level programming. Understanding number bases helps you debug issues, optimize code, and work more effectively with computer systems at a fundamental level.
Binary uses only two digits: 0 and 1. It's the fundamental number system used by all digital computers because electronic circuits can easily represent two states (on/off, high/low voltage). Each binary digit is called a "bit," and groups of 8 bits form a "byte." Binary is used in digital logic, computer architecture, and represents the lowest level of computer data.
Example: Binary 1010 = Decimal 10 (calculation: 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10)
Octal uses eight digits: 0-7. It was historically popular in computing because it provides a more compact representation than binary while being easy to convert (each octal digit corresponds to exactly 3 binary digits). Octal is still commonly used for Unix/Linux file permissions, where each digit represents read/write/execute permissions for user/group/others.
Example: Octal 12 = Decimal 10 (calculation: 1×8¹ + 2×8⁰ = 8 + 2 = 10)
Decimal uses ten digits: 0-9. It's the standard number system used by humans in everyday life, likely because humans have ten fingers. Decimal is used for human-readable numbers, user interfaces, and any situation where numbers need to be understood by non-technical users. In programming, decimal numbers are often the interface between machine representation and human understanding.
Hexadecimal uses sixteen digits: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Hex provides a very compact way to represent binary data, with each hex digit corresponding to exactly 4 binary digits. It's widely used for memory addresses, color codes in web design (#RRGGBB), MAC addresses, and representing binary data in a more readable format.
Example: Hexadecimal A = Decimal 10, Hexadecimal F = Decimal 15, Hexadecimal 10 = Decimal 16
Converting between number bases involves two steps:
For example, converting binary 1010 to hexadecimal:
Our tool handles these calculations automatically, providing instant, accurate conversions for any valid number in any supported base.
Here are some common conversions:
Notice that hex FF = decimal 255 = binary 11111111 (8 bits all set to 1), which is the maximum value for a single byte.
Our number base converter uses JavaScript's built-in parseInt() and toString() methods:
parseInt(number, base) converts from any base to decimalnumber.toString(base) converts decimal to any baseThe tool validates input to ensure it contains only valid digits for the selected base before attempting conversion. All processing happens client-side for instant results and privacy.
JavaScript can safely represent integers up to 2⁵³ - 1 (9,007,199,254,740,991). Beyond this, precision may be lost. For most practical purposes, this limit is more than sufficient.
This tool focuses on positive integers. Negative numbers in different bases require understanding signed number representations (two's complement, etc.), which is more complex.
Hex is more compact and easier to read than binary while maintaining a direct conversion (each hex digit = 4 binary digits). It's a good compromise between machine representation and human readability.
Binary: 0-1, Octal: 0-7, Decimal: 0-9, Hexadecimal: 0-9 and A-F (or a-f, case doesn't matter).
This tool handles integers. Fractional number conversion is more complex and requires separate handling of the integer and fractional parts.