Hexadecimal to Binary Converter Online

To convert a hexadecimal digit to a binary value, look up the digit in a conversion table and write down the corresponding binary value. Repeat this process for each hexadecimal digit in the number, and combine the resulting binary values to get the binary equivalent of the original hexadecimal number.

To convert a hexadecimal number to a binary number:

  1. Write down the binary values for each hexadecimal digit
Hexadecimal DigitBinary Value
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111
  1. Replace each hexadecimal digit with its corresponding binary value.
  2. The resulting string of binary digits is the equivalent of the original hexadecimal number in binary format.

Find the binary value of AF185:

Number hexadecimal:AF185
Result:10101111000110000101

Example in Javascript code:

function hexToBinary(hexString) {
	const decimalNumber = parseInt(hexString?.toUpperCase(), 16);
	const binaryString = decimalNumber.toString(2);
	return binaryString;
}

Example in C# code:

public string HexToBinary(string hexString)
{
    int decimalNumber = int.Parse(hexString, System.Globalization.NumberStyles.HexNumber);
    string binaryString = Convert.ToString(decimalNumber, 2);
    return binaryString;
}