Hex/Decimal/Binary Converter
Convert between hexadecimal, decimal, binary and octal
Three Number Systems, One Converter
Decimal (base-10) is how humans count using ten digits, a system we adopted because we have ten fingers. Binary (base-2) is how computers compute using two states, on and off, high voltage and low voltage, one and zero. Hexadecimal (base-16) is the shorthand that programmers use because it maps cleanly to binary (each hex digit represents exactly 4 binary bits) while being far more compact and readable than long binary strings. Enter a number in any base above and see the equivalent value in all three systems instantly. The converter handles integers of arbitrary size, not just 8-bit or 32-bit values, so you can convert large memory addresses, hash values, and protocol fields without overflow limitations.
Why Hexadecimal Exists and Why Programmers Prefer It
Binary is essential for understanding how computers work but unwieldy for human use. The byte value 11111010 is hard to read, hard to compare with other values, and nearly impossible to remember. Its hexadecimal equivalent, FA, is compact, visually distinct, and easy to remember. The key relationship: since 16 is a power of 2 (specifically 2^4), converting between binary and hex is trivial - split the binary number into groups of 4 bits and convert each group to a hex digit independently. 1111 1010 becomes F A. No arithmetic required, just a lookup of sixteen values. This is why memory addresses, MAC addresses, color codes, registry values, and error codes throughout computing are displayed in hexadecimal rather than decimal or binary. The hex value 0xFF is immediately recognizable to a programmer as 255 (a full byte, all bits set to 1) in a way that the decimal 255 does not convey the same structural significance.
Where Each Number System Appears in Practice
Binary appears in CPU register displays during hardware debugging, bitwise operations in source code, network subnet masks and IP address calculations, Unix file permission analysis, and digital circuit design. Decimal is used for user-facing numbers in applications, mathematical calculations, TCP/UDP port numbers (HTTP is port 80, HTTPS is port 443), IP address octets (each is a decimal number 0-255), and process IDs. Hexadecimal appears in memory addresses (0x7FFF5FBFF8AC), CSS and design color codes (#FF5733, #2E86C1), MAC/hardware addresses (00:1A:2B:3C:4D:5E), Unicode code points (U+1F600 for the 😀 emoji), escape sequences in strings (\x0A for newline, \x00 for null), hex dumps from binary file editors, and cryptographic hash outputs (SHA-256 produces 64 hex characters representing 256 bits). Fluency in reading and mentally converting between these systems is a fundamental skill for anyone working with code, networks, protocols, or data at a structural level.
Octal: The Fourth Number System
Octal (base-8) uses digits 0-7. It was more prevalent in early computing when word sizes were multiples of 3 bits (6-bit, 12-bit, and 36-bit machines), making octal a natural grouping. Today, octal survives primarily in Unix/Linux file permissions: the command chmod 755 sets permissions using three octal digits. Each octal digit represents exactly 3 bits, so 7 = 111 (rwx), 5 = 101 (r-x), and 0 = 000 (---). Octal also appears in C/C++ string literals where \0 represents a null byte and \012 represents a newline (octal 12 = decimal 10 = the ASCII newline character). In most modern contexts, hexadecimal has replaced octal as the preferred compact representation of binary data because contemporary word sizes (8, 16, 32, 64 bits) are powers of 2 that divide evenly into 4-bit hex digits but not into 3-bit octal digits.
Two's Complement: How Computers Handle Negative Numbers
Computers cannot store a minus sign. Instead, signed integers use two's complement representation, where the most significant bit indicates the sign: 0 for positive, 1 for negative. In an 8-bit two's complement system, the value 01111111 is +127 (the maximum positive value), 00000000 is 0, and 11111111 is -1 (not 255, which is the unsigned interpretation of the same bit pattern). The value 10000000 is -128, not -0. This representation means that addition works the same way for both positive and negative numbers at the hardware level, eliminating the need for separate addition and subtraction circuits. When converting between hex, decimal, and binary, understanding whether the value is signed or unsigned matters: the hex value 0xFF is 255 unsigned or -1 signed in an 8-bit context. The converter shows the unsigned decimal value by default; interpret as signed based on your context's word size.
Frequently asked questions
Is this tool free to use?
Is my data kept private?
Does it work on mobile devices?
Can I use the results commercially?
How accurate are the results?
How do I report a bug or suggest a feature?
Rate This Calculator
Your feedback helps us improve our tools