Hex Binary Converter
Convert between hexadecimal, binary, decimal, and octal number systems. See nibble breakdowns, bit counts, and signed/unsigned values.
Hex Binary Converter
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Each hex digit = 4 binary bits (nibble)
Worked example โ Binary: 00011010 00101011 00111100 | RGB(26, 43, 60) | Decimal: 1,715,004
Formula
Each hex digit = 4 binary bits (nibble)
Hexadecimal uses base-16 (digits 0-F), binary uses base-2 (digits 0-1). Each hex digit maps to exactly 4 binary digits: 0=0000, 1=0001, ..., 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. Conversion between bases uses positional notation: value = sum of (digit x base^position).
Worked Examples
Example 1: Convert Hex Color Code to Binary
Problem:Convert the web color #1A2B3C to its binary representation and identify the RGB values.
Solution:Hex 1A2B3C split into nibbles: 1 = 0001, A = 1010, 2 = 0010, B = 1011, 3 = 0011, C = 1100 Binary: 0001 1010 0010 1011 0011 1100 Red: 1A hex = 0001 1010 = 26 decimal Green: 2B hex = 0010 1011 = 43 decimal Blue: 3C hex = 0011 1100 = 60 decimal Decimal total: 1,715,004
Result:Binary: 00011010 00101011 00111100 | RGB(26, 43, 60) | Decimal: 1,715,004
Example 2: Convert Binary IP Address to Hex
Problem:Convert the binary representation 11000000 10101000 00000001 00000001 (192.168.1.1) to hexadecimal.
Solution:Group into nibbles and convert: 1100 = C, 0000 = 0 -> C0 1010 = A, 1000 = 8 -> A8 0000 = 0, 0001 = 1 -> 01 0000 = 0, 0001 = 1 -> 01 Hex result: C0A80101 Decimal: 3,232,235,777 32 bits = 4 bytes
Result:Hex: C0A80101 | Decimal: 3,232,235,777 | 32 bits (4 bytes)
Frequently Asked Questions
How do you convert hexadecimal to binary?
Converting hexadecimal to binary is straightforward because each hexadecimal digit maps directly to exactly four binary digits (bits), also called a nibble. To convert, simply replace each hex digit with its four-bit binary equivalent: 0 becomes 0000, 1 becomes 0001, through 9 which becomes 1001, then A becomes 1010, B becomes 1011, C becomes 1100, D becomes 1101, E becomes 1110, and F becomes 1111. For example, the hex value 2F becomes 0010 1111 in binary. This direct mapping is why hexadecimal was adopted as a compact representation of binary data in computing. A single byte (8 bits) is always represented by exactly two hex digits.
Why is hexadecimal used in computing instead of binary?
Hexadecimal is used because it provides a much more compact and human-readable representation of binary data. A single hex digit represents four bits, so an 8-bit byte is written as just two hex characters instead of eight binary digits. A 32-bit memory address like 11000000101010000000000100000001 becomes C0A80101, which is far easier to read, type, and remember. Hexadecimal is used extensively in programming for memory addresses, color codes in web design (like FF5733), MAC addresses in networking, assembly language, debugging, and file hex dumps. The base-16 system aligns perfectly with the power-of-two architecture of modern computers since 16 equals 2 to the fourth power.
What is the difference between signed and unsigned binary representation?
In unsigned binary, all bits represent the magnitude of the number, so an 8-bit value ranges from 0 (00000000) to 255 (11111111). In signed binary using two's complement representation, the most significant bit indicates the sign: 0 for positive and 1 for negative. An 8-bit signed value ranges from negative 128 (10000000) to positive 127 (01111111). To negate a two's complement number, invert all bits and add one. For example, positive 5 is 00000101; inverting gives 11111010, adding one gives 11111011, which represents negative 5. Two's complement is the standard signed integer representation in virtually all modern computer architectures because it simplifies arithmetic operations.
How do nibbles and bytes relate to hex and binary?
A nibble is a group of four bits, which is half of a byte and corresponds to exactly one hexadecimal digit. A byte consists of eight bits or two nibbles, represented by exactly two hex digits. For example, the byte 10110101 splits into nibbles 1011 and 0101, which convert to hex B and 5, giving the hex value B5. This hierarchical relationship extends further: a word is typically two bytes (four hex digits), and a double word is four bytes (eight hex digits). Understanding nibble boundaries is important when reading hex dumps, configuring network masks, and working with BCD (Binary Coded Decimal) encoding where each decimal digit is stored in a separate nibble.
How is hexadecimal used in web colors and CSS?
Web colors use hexadecimal notation to represent RGB (Red, Green, Blue) color values. A hex color code consists of a hash symbol followed by six hex digits, where the first two digits specify the red channel intensity (0 to 255), the middle two specify green, and the last two specify blue. For example, the color code #FF5733 means red is FF (255), green is 57 (87), and blue is 33 (51), producing a vivid orange-red color. Pure red is #FF0000, pure green is #00FF00, pure blue is #0000FF, white is #FFFFFF (all channels at maximum), and black is #000000. CSS also supports shorthand notation where #F00 expands to #FF0000. Understanding hex-to-decimal conversion helps designers fine-tune color values precisely.
Why do Unix file permissions use octal instead of hexadecimal?
Because permissions arrive in groups of three bits and an octal digit is exactly three bits wide. Read, write and execute carry the weights 4, 2 and 1, so a single digit describes one class of user: 7 is 111, or rwx, and 5 is 101, or r-x. The familiar mode 755 therefore reads rwxr-xr-x. Hexadecimal, at four bits per digit, would straddle those triads and destroy the pattern, which is why octal survives in chmod while hex dominates everywhere byte-aligned.
What is endianness, and why does the same value look reversed in a memory dump?
A multi-byte value has to be laid out in some order. Big-endian puts the most significant byte at the lowest address, so 0x1A2B3C4D appears as 1A 2B 3C 4D. Little-endian, used by x86 and most ARM configurations, stores the least significant byte first, so the identical word appears as 4D 3C 2B 1A. The number has not changed - only its byte layout. Internet protocols standardise on big-endian, which is why that order is called network byte order.
Why do very large hexadecimal values lose accuracy in a browser-based tool?
JavaScript numbers are IEEE 754 doubles, exact for integers only up to 2^53 - 1, which is 9,007,199,254,740,991. Anything beyond about 13 hex digits can therefore round. Bitwise operators are stricter still: they coerce operands to 32-bit signed integers, so the upper half of a 64-bit value simply disappears and the sign flips at 0x80000000. For 64-bit registers, file offsets or hash values, use BigInt with a 0x literal instead of parseInt.
How do I convert hexadecimal to decimal by hand?
Give each digit a weight of 16 raised to its position, counting from zero at the right, then sum. 0x1A2B is 1 x 4096 + 10 x 256 + 2 x 16 + 11 = 4096 + 2560 + 32 + 11 = 6699. For longer values Horner's method is faster and needs no powers of sixteen: start at the leftmost digit and repeatedly multiply the running total by 16 and add the next digit, giving 1, then 26, then 418, then 6699.
What am I looking at in a hex dump, and what is a magic number?
A hex dump prints a byte offset in the left column, typically sixteen bytes of hexadecimal in the middle, and a printable-ASCII gutter on the right, so binary structure and embedded text can be read side by side. The opening bytes of a file are often a magic number identifying the format: a PNG begins 89 50 4E 47, whose ASCII portion spells PNG, and a PDF begins 25 50 44 46, which is %PDF. Tools such as xxd, hexdump and od produce these views.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎHex Color Converter (HEX, RGB, HSL)
Calculate hex color converter with inputs, formulas, and instant results.
๐งฎEpoch Timestamp Converter Calculator
Calculate epoch timestamp converter with inputs, formulas, and instant results.
๐งฎTimezone Offset Converter Calculator
Calculate timezone offset converter with inputs, formulas, and instant results.
๐งฎRGB to CMYK Converter
Calculate rgb to cmyk converter with interactive inputs and clear steps.
๐งฎRGB HSL HSV Converter
Calculate rgb hsl hsv converter with interactive inputs and clear steps.
๐งฎCSS Unit Converter
Calculate css unit converter with inputs, formulas, and instant results.
๐งฎFile Size Converter
Calculate file size converter with inputs, formulas, and instant results.
๐งฎJSON to CSV Converter
Convert JSON data to CSV format and vice versa with field mapping and delimiter options.