IP Address to Hex Converter

[insert_php]
if($_POST){
$ip = $_POST[‘ip’];
$ip_split = explode(‘.’, $ip);
$hexvalue = sprintf(‘%02x%02x%02x%02x’, $ip_split[0], $ip_split[1], $ip_split[2], $ip_split[3]);
}
[/insert_php]

Here you can convert an IP-address
to the hex-value. Just type in your IP-address and press enter.

 

[insert_php]
if(isset($hexvalue)){
echo “”;
echo “IP-Address = “.$ip;
echo “
“;
echo “Hex-Value = “.$hexvalue;
echo “
“;
}
[/insert_php]

6 thoughts on “IP Address to Hex Converter”

  1. Am I using this correctly please?

    I receive this message on an email from wordfence. “A user with IP address 2a01:4f8:211:39f:0:0:0:2 has been locked out from signing in or using the password recovery form for the following reason: Exceeded the maximum number of login failures which is: 5.”

    That number isn’t a normal IP, so does your converter recognise this?

    • Hi Robert,

      That is an IPv6 address, it is indeed in hex format, however, this tool serves a different purpose. This converts IPv4 which is dotted decimal notation, to HEX.

      Jz

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.