Free Number Base Converter | Convert Between Binary, Octal, Decimal and Hexadecimal Instantly
Need to convert a number between binary, octal, decimal, and hexadecimal? Thetoolity's free number base converter handles all four number systems simultaneously. Type in any field and every other base updates instantly. No button to click, no steps to follow.
Whether you are a student learning computer science, a developer working with memory addresses and color codes, or an electronics engineer reading hardware specifications, our converter gives you instant, accurate results for all four bases at once.
How to Use the Number Base Converter
The converter updates all four fields simultaneously as you type. There is no Convert button because the results appear instantly.
To convert from decimal: click the Decimal field and type your number. The equivalent values in Binary, Octal, and Hexadecimal appear immediately in the other three fields.
To convert from binary: click the Binary field and type your binary number using only the digits 0 and 1. The Decimal, Octal, and Hexadecimal equivalents appear instantly.
To convert from octal: click the Octal field and type your number using digits 0 through 7. All other representations update in real time.
To convert from hexadecimal: click the Hexadecimal field and type your hex number using digits 0 through 9 and letters A through F. All other fields update immediately.
The Quick Reference table below the converter shows the four bases side by side for the values 0, 10, and 255, giving you an instant sanity check for common values.
The Four Number Systems Explained
Every number system is built around a base, which determines how many unique digits the system uses and what value each digit position represents. Here is a complete explanation of the four number systems supported by Thetoolity's converter.
Decimal (Base 10)
Decimal is the number system humans use in everyday life. It has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. When you count past 9, you run out of single digits and roll over to a two-digit number: 10. The position of each digit represents a power of 10.
In the decimal number 3,742, the 2 is in the ones place (2 times 10 to the power of 0, which is 1), the 4 is in the tens place (4 times 10 to the power of 1), the 7 is in the hundreds place (7 times 10 to the power of 2), and the 3 is in the thousands place (3 times 10 to the power of 3). Adding those up: 2 plus 40 plus 700 plus 3,000 gives 3,742.
Decimal is the natural number system for humans because we evolved with ten fingers. It is the default in everyday life, commerce, and most non-technical computing contexts.
Binary (Base 2)
Binary is the fundamental number system of all digital computers. It has exactly two digits: 0 and 1. These correspond to the two states of a transistor: off and on, low voltage and high voltage, false and true.
Every piece of data stored in a computer, every instruction a processor executes, and every signal transmitted over a network is ultimately represented as a sequence of binary digits called bits. A group of 8 bits is called a byte. A byte can represent 256 different values (0 through 255 in decimal).
In the binary number 11010, the positions represent powers of 2. Reading right to left: 0 times 1 (power 0), 1 times 2 (power 1), 0 times 4 (power 2), 1 times 8 (power 3), 1 times 16 (power 4). Adding: 0 plus 2 plus 0 plus 8 plus 16 equals 26 in decimal.
Binary numbers can become very long very quickly. The decimal number 255 is 11111111 in binary, which is eight binary digits (one byte). The decimal number 65,535 requires sixteen binary digits. This length is why octal and hexadecimal exist as shorthand for binary.
Octal (Base 8)
Octal uses eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. It was more commonly used in older computing systems, particularly early Unix-based systems, and is still encountered in file permission notation on Unix and Linux systems.
In Linux and Unix, the chmod command uses octal numbers to represent file permissions. The permission 755 in octal represents read, write, and execute for the owner, and read and execute for group and others. The value 644 represents read and write for the owner and read-only for others.
Octal is convenient because each octal digit corresponds exactly to three binary digits. This makes converting between binary and octal straightforward without needing to work through decimal as an intermediate step. The binary sequence 011 101 101 converts directly to octal 355 by converting each three-bit group separately.
Position values in octal are powers of 8. The octal number 754 equals 4 times 1 plus 5 times 8 plus 7 times 64, which is 4 plus 40 plus 448, giving 492 in decimal.
Hexadecimal (Base 16)
Hexadecimal, commonly called hex, uses sixteen digits. It uses 0 through 9 for the first ten values, then the letters A through F (case-insensitive) for the values 10 through 15. A represents 10, B represents 11, C represents 12, D represents 13, E represents 14, and F represents 15.
Hexadecimal is the most widely used non-decimal number system in computing today. It appears everywhere in software development and systems programming.
Each hexadecimal digit corresponds exactly to four binary digits (one nibble). This makes hex an extremely compact and readable representation of binary data. A byte (8 bits) is always exactly two hex digits. For example, 11111111 in binary (255 in decimal) is FF in hexadecimal. 00000000 (0) is 00. 10101010 (170) is AA.
Position values in hex are powers of 16. The hex number 2F equals F (15) times 1 plus 2 times 16, which is 15 plus 32, giving 47 in decimal. The hex number FF equals F (15) times 1 plus F (15) times 16, which is 15 plus 240, giving 255 in decimal.
Why Hexadecimal Is Used in Computing
Hexadecimal is encountered constantly in software development, web design, digital electronics, and cybersecurity. Understanding where it appears and why it is used helps developers and students work with hex values confidently.
Memory addresses in computer systems are expressed in hexadecimal. When a debugger shows you a pointer value like 0x7FFD4B2C, the 0x prefix indicates a hexadecimal number. Memory addresses in hexadecimal are much shorter and more readable than the same addresses in decimal or binary.
HTML and CSS color codes use hexadecimal. A hex color like #FF5733 has three components: FF (255 in decimal) for red, 57 (87 in decimal) for green, and 33 (51 in decimal) for blue. Each color channel is one byte, represented as exactly two hex digits. This is why hex colors always have six digits and can represent 256 levels for each of the three color channels.
ASCII and Unicode values are expressed in hexadecimal in documentation and programming contexts. The ASCII code for the uppercase letter A is 65 in decimal and 0x41 in hex. Unicode code points are written in hex: the copyright symbol is U+00A9 and the emoji thumbs up is U+1F44D.
File format signatures (magic bytes) are the first bytes of a file that identify its format. These are always shown in hex. A PDF file starts with 25 50 44 46 in hex. A JPEG file starts with FF D8 FF. A PNG file starts with 89 50 4E 47. Security professionals and developers examining binary files work in hex.
Network protocols and packet headers use hexadecimal. IP addresses in their raw binary form, MAC addresses on network interfaces, and protocol header fields are all displayed and manipulated in hex.
Assembly language and machine code use hexadecimal extensively. Machine instructions, opcodes, and memory offsets are all expressed in hex because it maps cleanly to the underlying binary.
Cryptographic outputs including hash values, encryption keys, and digital signatures are almost always represented as hexadecimal strings. A SHA-256 hash is a 64-character hexadecimal string representing 256 bits.
How to Convert Between Number Bases: The Complete Method
Understanding the conversion algorithm is essential for computer science students and useful for any developer who needs to do quick conversions without a calculator.
Decimal to Binary (Step by Step)
The division-by-2 method converts decimal to binary. Divide the decimal number by 2 and record the remainder (which is always 0 or 1). Divide the quotient by 2 and record the remainder. Continue until the quotient is 0. Read the remainders from bottom to top.
Example: Convert 43 to binary. 43 divided by 2 is 21 remainder 1. 21 divided by 2 is 10 remainder 1. 10 divided by 2 is 5 remainder 0. 5 divided by 2 is 2 remainder 1. 2 divided by 2 is 1 remainder 0. 1 divided by 2 is 0 remainder 1.
Reading remainders from bottom to top: 101011. The decimal number 43 is 101011 in binary.
Binary to Decimal (Step by Step)
Write down the binary number. Assign powers of 2 to each digit position starting from 0 at the rightmost position. Multiply each binary digit by its corresponding power of 2. Add all the results.
Example: Convert 101011 to decimal. Positions right to left: 1 times 1 (power 0) = 1. 1 times 2 (power 1) = 2. 0 times 4 (power 2) = 0. 1 times 8 (power 3) = 8. 0 times 16 (power 4) = 0. 1 times 32 (power 5) = 32. Sum: 1 plus 2 plus 0 plus 8 plus 0 plus 32 = 43.
Decimal to Hexadecimal
Use the division-by-16 method. Divide the decimal number by 16 and record the remainder (0 through 15, converting 10-15 to A-F). Divide the quotient by 16 and record the remainder. Continue until the quotient is 0. Read remainders from bottom to top.
Example: Convert 255 to hexadecimal. 255 divided by 16 is 15 remainder 15. Remainder 15 = F. 15 divided by 16 is 0 remainder 15. Remainder 15 = F. Reading from bottom to top: FF. The decimal number 255 is FF in hexadecimal.
Binary to Hexadecimal (The Fast Way)
Group the binary digits into groups of four from right to left (padding with leading zeros if needed). Convert each group of four directly to its hexadecimal digit.
The 16 possible four-bit groups are: 0000=0, 0001=1, 0010=2, 0011=3, 0100=4, 0101=5, 0110=6, 0111=7, 1000=8, 1001=9, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F.
Example: Convert 11010111 to hexadecimal. Group: 1101 and 0111. 1101 = D. 0111 = 7. Result: D7. The binary number 11010111 is D7 in hexadecimal.
Hexadecimal to Binary (The Fast Way)
The reverse: convert each hex digit directly to its four-bit binary equivalent.
Example: Convert 3F to binary. 3 = 0011. F = 1111. Result: 00111111.
Binary and Octal
Each octal digit corresponds to three binary digits. Group binary digits in threes from right to left. Convert each group to its octal digit.
The eight possible three-bit groups are: 000=0, 001=1, 010=2, 011=3, 100=4, 101=5, 110=6, 111=7.
Binary, Octal, Decimal, and Hexadecimal Reference Table
This quick reference table shows the equivalents across all four bases for values 0 through 20, plus key values that appear frequently in computing.
Value 0: Binary 0, Octal 0, Hex 0
Value 1: Binary 1, Octal 1, Hex 1
Value 2: Binary 10, Octal 2, Hex 2
Value 3: Binary 11, Octal 3, Hex 3
Value 4: Binary 100, Octal 4, Hex 4
Value 5: Binary 101, Octal 5, Hex 5
Value 6: Binary 110, Octal 6, Hex 6
Value 7: Binary 111, Octal 7, Hex 7
Value 8: Binary 1000, Octal 10, Hex 8
Value 9: Binary 1001, Octal 11, Hex 9
Value 10: Binary 1010, Octal 12, Hex A
Value 11: Binary 1011, Octal 13, Hex B
Value 12: Binary 1100, Octal 14, Hex C
Value 13: Binary 1101, Octal 15, Hex D
Value 14: Binary 1110, Octal 16, Hex E
Value 15: Binary 1111, Octal 17, Hex F
Value 16: Binary 10000, Octal 20, Hex 10
Value 32: Binary 100000, Octal 40, Hex 20
Value 64: Binary 1000000, Octal 100, Hex 40
Value 128: Binary 10000000, Octal 200, Hex 80
Value 255: Binary 11111111, Octal 377, Hex FF
Value 256: Binary 100000000, Octal 400, Hex 100
Value 1024: Binary 10000000000, Octal 2000, Hex 400
Value 65535: Binary 1111111111111111, Octal 177777, Hex FFFF
Value 65536: Binary 10000000000000000, Octal 200000, Hex 10000
Number Bases in Programming Languages
Every major programming language has built-in notation for writing literal values in different bases and functions for converting between them.
In Python: Binary literals are prefixed with 0b (e.g., 0b1010 = 10). Octal literals use 0o prefix (e.g., 0o12 = 10). Hexadecimal literals use 0x prefix (e.g., 0xA = 10). The built-in functions bin(), oct(), and hex() convert integers to binary, octal, and hex strings respectively. int('1010', 2) converts a binary string to an integer. int('FF', 16) converts a hex string.
In JavaScript: Binary literals use 0b prefix. Octal uses 0o prefix. Hexadecimal uses 0x prefix. The Number.toString(base) method converts a number to a string in any base from 2 to 36. parseInt('1010', 2) parses a binary string. parseInt('FF', 16) parses a hex string. The toString(16) method on a number produces a hex string.
In Java: Hexadecimal literals use 0x prefix. Octal literals use a leading 0 (e.g., 012 = 10). Binary literals use 0b prefix. Integer.toBinaryString(), Integer.toOctalString(), and Integer.toHexString() convert integers to string representations. Integer.parseInt("FF", 16) parses a hex string.
In C and C++: Hexadecimal literals use 0x prefix. Octal literals use a leading 0. No binary literal notation exists in C89 or C99 (though C23 and GCC as an extension support 0b). Printf format specifiers %d, %o, and %x print integers in decimal, octal, and hexadecimal respectively.
In SQL: Hexadecimal values are written with 0x prefix in MySQL. In PostgreSQL, the notation is x'FF'. Different databases have different syntaxes for hex literals.
Real-World Applications of Number Base Conversion
Base conversion is not just an academic exercise. It appears constantly in practical computing work.
Reading and writing file permissions on Linux and Unix systems uses octal. The command chmod 755 myfile.sh sets permissions to 111 101 101 in binary, meaning read-write-execute for owner, read-execute for group, and read-execute for others. Understanding this requires knowing octal and its relationship to binary.
Working with HTML and CSS colors requires hexadecimal. Every web designer and frontend developer uses hex color codes like #3B82F6 (a shade of blue). Understanding that each pair of hex digits represents one color channel (red, green, blue) each from 0 to 255 helps designers modify colors intelligently. Changing FF to 80 in the red channel halves the red intensity.
Debugging and reading memory dumps in any debugger shows memory contents in hexadecimal. Understanding that 0xFF is 255, 0x00 is 0, and 0x7F is 127 (the maximum positive value of a signed byte) is fundamental to reading debug output.
Understanding IP addresses in their binary form reveals the structure behind subnetting, CIDR notation, and network masks. The subnet mask 255.255.255.0 is 11111111.11111111.11111111.00000000 in binary, making it visually clear which bits identify the network and which identify the host.
Reading ASCII tables and Unicode code pointsrequires fluency with hex. The capital letter A is 0x41. The space character is 0x20. The line feed character is 0x0A. Developers who work with character encoding, string processing, or text protocols need to recognize these values instantly.
Writing bitwise operations in code requires understanding binary. Operations like bitwise AND, OR, XOR, and bit shifting are meaningful only when you can visualize the binary representations of the operands and understand what bits are being manipulated.
Frequently Asked Questions
What is a number base converter?+
What is binary and why does it matter?+
What is hexadecimal?+
How do I convert decimal to binary?+
How do I convert binary to decimal?+
How do I convert decimal to hexadecimal?+
What is the fastest way to convert binary to hexadecimal?+
What does 0x mean in front of a number?+
What is octal and where is it used?+
Why does hexadecimal use letters?+
What is the difference between binary and decimal?+
Why Thetoolity?
Thetoolity is a growing collection of free, fast, and clean online tools for students, developers, engineers, and anyone who works with technical computing topics. Our number base converter is one of many tools designed to give you instant, accurate results across all supported formats simultaneously, with no account required and no data leaving your device.
No subscriptions. No paywalls. No cluttered interfaces. Just tools that load instantly and work every time.
Explore the full collection at Thetoolity.com and find generators, converters, calculators, checkers, and testers, all free and all instant.