Checking a hexadecimal value through binary groups
Each hexadecimal digit stands for exactly four binary digits. This guide uses that mapping to check a conversion, and shows where leading zeros appear and disappear.
Sixteen digits, four bits
Hexadecimal uses sixteen symbols: 0 to 9 for the values zero through nine, and A to F for ten through fifteen. Four binary positions can hold sixteen different patterns, from 0000 to 1111, so each hex digit corresponds to exactly one four-bit group. A is 1010, B is 1011, C is 1100, D is 1101, E is 1110 and F is 1111. The digits 5 and 0 are 0101 and 0000. This one-to-one mapping is why programmers use hexadecimal as a compact way to write binary data. Two hex digits describe one byte of eight bits, and the correspondence involves no arithmetic beyond a table lookup. The standards that define hexadecimal text for programming languages, such as the 0x prefix in C and many descendants, use the same sixteen symbols, and letters are accepted in either case by most parsers. The converter on this site prints uppercase letters, so a comparison with a lowercase dump should ignore case.
Checking A5
The hexadecimal value A5 has two digits. Replacing each with its group gives A = 1010 and 5 = 0101, so the bits are 1010 0101, or 10100101 with the space removed. As a decimal value that is 10 × 16 + 5 = 165. The integer base converter, set from base 16 to base 2, returns 10100101 for A5, which matches the first worked case. Reading the groups left to right and checking each against the table is a two-step process that you can finish in your head, and it verifies the converter output digit by digit.
Why the low digit alone loses a zero
Converting just the digit 5 gives 101, three digits, not 0101. The converter writes a whole number in the shortest form, so it drops leading zeros. This matches ordinary decimal notation, where 7 is written 7 and not 007. In a byte layout, though, the low field is a fixed four bits wide, so 5 appears as 0101. The extra zero does not change the value, and the third worked case shows this by converting 0101 from base 2 to base 10 and getting 5. The difference is in written width, a display choice, not in the number.
More conversions to practice
The hex value 3F maps to 0011 and 1111. The converter shows 111111 because the leading 00 is dropped, and 3F is 63 in decimal. FF is 11111111, the largest unsigned byte at 255. The value 2C maps to 0010 and 1100, so the converter returns 101100, and 2C is 44. A single digit B maps to 1011. Convert each digit separately first, join the groups, then strip leading zeros to compare with the converter. Checking two or three of these builds a feel for how the mapping behaves, especially for values whose first digit is 1, 2 or 3 where leading zeros show up.
Padding to a fixed width
Many formats call for a fixed number of bits. A byte is eight, so the number 5 would be stored as 00000101, which in hex is 05. When you read a binary string from a datasheet or a memory dump, the width is part of the format, and the leading zeros carry meaning there even though they carry no numeric value. To produce a padded string from the converter output, count the digits, subtract from the target width, and prepend that many zeros. For 101 and a width of 8, that is five zeros. The converter does not do this automatically, so the formatting step remains with the reader.
Converting back from binary to hex
The reverse direction groups bits from the right, in fours. Take 10100101 and split it as 1010 and 0101, then look up A and 5 to get A5. If the number of bits is not a multiple of four, pad on the left with zeros first. The string 101100 has six bits, so pad to 00101100 and read 2 and C, giving 2C. Grouping from the left instead would give a wrong split. The right-aligned grouping is the one that matches place values, since each group of four bits is worth 16 times the group to its right.
Where the mapping is used
Hexadecimal appears in color codes, memory addresses, MAC addresses and byte dumps. The web color #FF8000 has three bytes: FF is 255 red, 80 is 128 green and 00 is 0 blue. Each byte is two hex digits and eight bits, which is why the compact form is convenient. Using the digit table is also quicker than converting the whole value through decimal. Debugging tools show memory in hex since reading 32 bits as eight hex digits is much easier than reading 32 ones and zeros. In all of these cases, the hex string is a notation for the same bits, and converting between them with the table or the converter changes the representation but not the value.
Octal and other groupings
The same trick works for other bases that are powers of two. Octal digits stand for three bits each, so 101 100 reads as octal 54, and 54 in octal is 44 in decimal, the same value as hexadecimal 2C. Base 4 uses two bits per digit. Base 10 has no such tie, because 10 is not a power of 2, which is why a decimal digit cannot be read off a fixed group of bits and decimal-to-binary conversion needs division. If you convert between hex and octal, passing through binary is the simplest route: regroup the same bit string in threes instead of fours. For 2C that is 00 101 100, padded on the left, which gives octal 054, or 54 once the leading zero is dropped.
Scope of the converter
The integer base converter parses a signed digit string and supports bases 2 through 36, using exact integer arithmetic. It normalizes the number, so uppercase output, no leading zeros and a minus sign for negatives are expected. It does not guarantee a particular byte layout, byte order or field width, and it does not interpret negative numbers in two's complement form. For fixed-width fields, apply the padding rule above and decide separately how negative values are represented in the format you are working with. Check the base fields too: the from-base for A5 is 16, and entering 10 would reject the letter A as an invalid digit.
Reproduce the checks
Whole two-digit value
Open the Integer Base Converter and enter:
- Value
A5- Source base
16- Target base
2
Expected output:
Value
10100101The complete value occupies eight binary positions.
Low digit alone
Open the Integer Base Converter and enter:
- Value
5- Source base
16- Target base
2
Expected output:
Value
101The numeric output omits a leading zero.
Four-position low field
Open the Integer Base Converter and enter:
- Value
0101- Source base
2- Target base
10
Expected output:
Value
5The padded group retains the same value.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08