Online Binary To Hex Convert Tool




About Binary to Hex (A free online tool to converts Binary to hex)

Binary to Hex tool convert binary number to hex string. Many times we wants to convert binary to hex that time we can use PHP provides inbuilt functions bindec() and dechex(). We have to use two functions that we can convert binary number to hex.Many developers and programmers are using this tools in daily life.

Syntax:
base_convert($string,2,16);

For Example:

There are two ways to convert a binary number to an hex number using built-in functions:

First Way:

Use bindec to convert the octal number to decimal, and then use dechex to convert the numeric decimal value to an binary string:

$binString = "110100101";
$binNumeric = bindec($binString);
$hexString = dechex($binNumeric); // = "1a5"

Second Way:

Use base_convert to convert the binary number directly to an hexadecimal string:

$binString = "110100101";
$hexString = base_convert($binString,2,16); // = "1a5"