ASCII to hex converter

ASCII to hex converter

﻿

ASCII to hex converter is a useful tool for anyone working with ASCII characters and needing to convert them to hexadecimal or short "hex" numbers. The ASCII to hex converter provided below is able to convert ASCII (or even Unicode) characters to both hexadecimal and unicode numbers. The ASCII to hex converter can be used for example to encode email addresses.

ASCII to hex converter

Below you can find ASCII to hex converter which you can use to convert ASCII to hex.

Enter your ASCII text:

Hexadecimal values:

Unicode values:

Easy as that.

How the ASCII to hex converter works?

The ASCII to hex converter is simple and just converts values defined in the ASCII table. See this link for more details about the ASCII table and code ASCII.

What for can I use the ASCII to hex converter?

The ASCII to hex converter can be used for example to protect email addresses provided on a web page. Spam bots usually crawl websites and look for email addresses. If they find something in the format of xxx@yyy.zz, they consider it a valid email address, grab it, store in some database, and someone then sends you spam. There is a way to prevent spam bots from harvesting email addresses from websites. Convert your email addresses in ASCII to hexadecimal.

Email addresses are usually encoded in the following notation:

<a href="mailto:foo@example.com">foo@example.com</a>

Email harvesters look for the mailto parameter, and if they find email address following it, they harvest it. Using ASCII to hex converter, you can convert ASCII email address to something less comprehendible, such as:

This was done using the ASCII to hex converter. The %66%6F%6F%... numbers are hexadecimal representations of ASCII characters. The &#x0066;&#x006F;&#x006F;... numbers are entities expressed in hexadecimal notation.

Is this email address protection perfect? Harvesting robots can convert hex back to ASCII, but not every harvesting robot is set up to include algorithm for doing so. Although the ASCII to hex conversion does not prevent all robots from email harvesting, ASCII to hex does help to some degree.

You can read more about other more robust email harvesting prevention techniques on the following two pages:

The script above, a PHP ASCII to hex converter converts ASCII to hex. First, the ord() function returns decimal ASCII value of a character stored in $ascii, and then the result expressed in decimal gets converted to hexadecimal (see the Dec to hex converter for more details on how this is accomplished).

If you want to do the opposite, that is to convert hex to ASCII, you can use the following script:

The script above converts hexadecimal to ASCII. First, the hexdec() PHP function converts the hexadecimal number stored in the $hex variable into decimal. (See the Hex to decimal converter page for more details about conversion from hex to decimal.) Then, the chr() function returns a one-character string containing the character specified by the result.

The ASCII to hex converter does not work

Ok, I have heard some people say the ASCII to hex converter fails when they convert from hex back to ASCII. That can happen, but it is not a problem with the ASCII to hex converter. It relates to the definition ASCII.

For example, someone typed the name of one Hungarian city into the ASCII box in the ASCII to hex converter. The name of the city is:

The letter in the name of the Hungarian city gets translated into hexadecimal 151 and unicode &#337;. When you hit the Decode hex to ASCII button, there will be a problem. The hexadecimal 151 will get translated into the following two characters:

Why the hexadecimal 151 in the ASCII to hex converter does not translate back to the Hungarian o? The answer can be found in the ASCII table. The ASCII table goes up to decimal 127 (0 to 127) which occupies one byte in binary. The Hungarian o is hexadecimal 151 which is decimal 337. That is more than the ASCII table can handle. The Hungarian o is a two byte character, and the basic ASCII table does not include a character to match it, so the two byte Hungarian o expressed in binary as 0000 0001 0101 0001 gets translated "incorrectly" into the two characters as shown above (negative acknowledge, dec 21, hex 15 and digit one, dec 49, hex 31). (Note: How did we find out the hex 151 is binary 0000 0001 0101 0001? See the Hex to dec converter page.)

ASCII to hex converter and other converters?

Besides the ASCII to hex converter, you can find a few other useful tools on our portal, such as

(The table bellow shows a list of 8 most recent topics posted in our discussion forum. Visit our discussion forum to see more. It is possible the links below are not related to this page, but you can be certain you will find related posts in the discussion forum. You can post one yourself too.)