Use example domains for examples

By Kristofer Palmvik ·

Over time I have seen a lot of documentation examples and, even worse, automated test cases that use some made-up domain name.

It could mention visiting a webpage at www.domain.com or sending an email to a (clever) e-mail address like em@il.com.

The problem is that, most likely, the person writing the documentation or test is not in control of that domain.

When a person or computer suddenly takes the example instructions a little bit too literal by mistake, worst case is that information ends up where it shouldn't be. And that could be a big problem.

What if the automated tests happens to sends out a large amount of real emails to a domain you don't own? Or somethings get misconfigured so that sensitive information is sent in the email? Or a URL that can be used to infer secret information is requested?

Luckily, there is a real simple fix: use example domains for examples.

example.com, example.org, and example.net are all reserved and "can be used as examples" of generic TLD domains.

This means that a URL like https://my.example.com or an email address like kristofer@example.com can be safely used without ever being mistaken for a real address.

But what if you need more than one domain, for example to illustrate different companies?

Any domain ending with .example is a reserved example domain: both kristofer.example and really.reserved.example.

This makes it much easier to illustrate different organizations. someone@buyer-company.example makes a payment through https://www.bank.example to recipient@seller-company.example.

If you happen to be based in Sweden it is good to know that example.se is registered by Internetstiftelsen and can be used in the same way.

In case you need an internationalized domain name (IDN) in an example, there are actually a few that can be safely used. مثال.إختبار (Arabic), 例子.測試 (Chinese), and 例え.テスト (Japanese). All the strings translates to example.test in each respective language.

As always you can of course use a domain you own and control yourself, although that might possibly change over time.