If I display my email address on my website, I would probably receive a lot of spam, so I can set up a contact form instead. If I want to display my phone number, how can I prevent unwanted phone calls?

  • 7
    You can trust the internet to be kind and not abuse your good intentions.
    – user10211
    Jan 2, 2013 at 2:23
  • 3
    If you feel you can't trust then purchase a sip configuration file and setup your own voip server using asterisk for example. You could then do a redirect with some voip antispam feature to avoid abuse. Sip configuration file cost about 50$ CAN and an asterisk server can run on a 20$ pentium 4 machine. If you wish to get a better encoding you can do so by purchasing a encoding licence to Digium. Those kind of config run smoothly even using 3g vpn as when setup properly the encoding can works great at as low as 100 kb/s. In other words, it could run over 3g in the back of your trunk lol
    – happy
    Jan 2, 2013 at 2:35

7 Answers 7


Well, the first thing is not to worry about it so much, because your threat model is unlikely.

Voice spammers don't get phone numbers by sending bots out to crawl the web, because they have much better sources of numbers.

And targeted attacks, where someone wants to prank call you specifically, can't be prevented because you can't tell who is an attacker and who is a customer.

If you still want to obscure your text, then here you can use similar techniques to those used to obscure email addresses:

  • Do the formatting weird so bots don't recognise it as a phone number.
  • Use an image of the number instead of the text. (But please don't do this, because it'll break accessibility.)
  • Shrug your shoulders and put good anti-spam in place.
  • 2
    +1 on this. You have no idea how often companies keep copies of the Experian credit database on USB sticks and the like. I can download a year-old copy of the UK one right now from a torrent, and it'd have ~20m home phone numbers in it, along with names and addresses.
    – Polynomial
    Jan 2, 2013 at 13:01
  • I tend to make info like emails or phone numbers be displayed by javascript, after a short delay or click on the field.
    – Sebi
    Mar 22, 2016 at 21:20
  • 1
    Voice spammers don't get phone numbers by sending bots out to crawl the web, because they have much better sources of numbers. @GrahamHill Can you give an example for that?
    – toogley
    May 6, 2016 at 9:07
  • 3
    @toogley any of the multitudes of online phonebook websites, or millions-scale data leaks?
    – Οurous
    Apr 27, 2017 at 14:43
  • 1
    The claim about voicespammers isn't true. The voicespammers buy their numbers from people who scrape the numbers. I set up a separate phone number specific to a service offered on a site and once the number was added to the page it began to receive bogus calls. Sep 13, 2021 at 14:10

If you are in the US or Canada, you could use Google Voice (or any other VOIP service) and supply the Google Voice number. Google has pretty good anti-spam features built in to Voice and you can block any numbers that are problematic or only allow it to forward to your phone at certain hours.


Google Voice gives you, for free, an alternate phone number that you can (selectively) forward to other numbers. They also have a widget you can embed onto a webpage that can be used to call you directly from the page.

  • The widget was a great idea; unfortunately it appears to be unsupported as of 2019. I had one on my website for many years and sometime recently it stopped working without any notification to me (sends back a 403 when submitted). I can no longer find an option to embed it. Jul 13, 2019 at 23:27

You can use the same methods that are used for e-mail adresses:

  • Replace with image (bad for accessibility)
  • Encode in some weird way (e.g. ROT13+Base64) and decode using JavaScript (prevents bots that cannot execute JS from reading it)
  • Require ReCaptcha to show (inconvenient)
  • Make hard to detect by inserting hidden text between the individual numbers

In addition to this, you can replace zeros with uppercase o's, however some scrapers can handle this (note that the scrapers I'm talking about are not used by spammers).

Honestly, I doubt phone spammers scrape web sites for numbers, much easier to simply dial all numbers and detect which ones exist.


create class in css id='hide' and set it to display=None;

then use this class in html as follows:

01482 <span id = 'hide'> 548asd46</span> 564654

this splits the number but hides what shouldnt be there


Not to be credited for. This is the source


<p><span class="rev email">emos</span></p>
<p><span class="rev phone">321</span></p>


span.rev { unicode-bidi:bidi-override; direction:rtl }
span.rev.email:before { content:"moc.etisbew" }
span.rev.email:after { content:"@nhoj :liamE" }
span.rev.phone:before { content:"987 654 " }
span.rev.phone:after { content:" 153+ :enohP" }

which will result in this



Another Possible Solution (?)

<iframe srcdoc="(NNN)NNN-NNNN"></iframe>

Depending on whether or not the bot will scrape the contentDocument of an <iframe> -- AND -- if that iframe is visible from "view page source", this may also be an option. I'd be interested to hear the thoughts of someone more versed in security than myself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .