Disguise Email Addresses for online publishing

Disguise your email address or any text with this character obfuscation. This code corey@example.com will show up on a web page as [email protected] You can share your email address without worrying that it will be collected by a spam bot.

Enter some plain text



Some losers send spam email for a living, and will send garbage to any email they can find online. Obfuscating email addresses in character codes cloaks them from some of the leeches. I decided to create code to automate this task.

Here is an ASP classic function that will convert a string to ASCII characters. PHP code below. These characters will display as normal text to the casual user. The difference between alphabet characters and ASCII characters is that encoded characters must be evaluated before they look like an email address. This thin veil of secrecy is enough to fight off some email harvesters.


public function asciiDisguise( string )
	build = ""
	for i=1 to len( "" & string )
		build = build & "&#" & asc( mid( string, i, 1 )) & ";"
	next
	asciiDisguise = build
end function

Here is the same function in PHP.


function asciiDisguise( $str ){
	$build = "";
	for( $i=0;$i<strlen( $str );$i++ ){
		$build .= "&#" . ord( substr( $str, $i, 1 )) . ";";
	}
	return $build;
}

Leave a comment

Your email address will not be published. Required fields are marked *