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?

  • 5
    You can trust the internet to be kind and not abuse your good intentions. – user10211 Jan 2 '13 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 '13 at 2:35

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.
| improve this answer | |
  • 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 '13 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 '16 at 21:20
  • 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 '16 at 9:07
  • 2
    @toogley any of the multitudes of online phonebook websites, or millions-scale data leaks? – Οurous Apr 27 '17 at 14:43

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.

| improve this answer | |

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.

| improve this answer | |
  • 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. – Soren Bjornstad Jul 13 '19 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.

| improve this answer | |

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.