Skip to content

Instantly share code, notes, and snippets.

@atoponce
Last active June 23, 2023 18:15
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save atoponce/4c94e964e0953c95c3d1e67454fbb7e7 to your computer and use it in GitHub Desktop.
Save atoponce/4c94e964e0953c95c3d1e67454fbb7e7 to your computer and use it in GitHub Desktop.
Best practices for examples in documentation

Reserved Examples

Below are examples for best practices that have been set aside specifically for writing documentation, fictional stories, source code, or anything else where an example needs to be given without the fear of resolving to an actual phone number, domain, website, etc.

Domain Names

In 1999, the "example.com" domains have been set aside by the IETF in RFC 2606 and updated in RFC 6761 specifically for documentation and source code. They include example.com, example.net, and example.org. The example.edu domain was added by ICANN in 2000. Later, the ".example" top-level domain name has since been added explicitly for documentation purposes. While the pseudo-top-level domain ".local" carries no meaning, it is commonly deployed in multicast DNS, local DNS, and private networks. While it too could be used for documentation, it's better left alone, and to use the "example.com" and ".example" domains.

However, "test" reserved domains in other languages exist also. These cannot be registered or transferred. They are:

Domain Domain (a-label) Language Script
إختبار xn--kgbechtv Arabic Arabic
آزمایشی xn--hgbk6aj7f53bba Persian Arabic
测试 xn--0zwm56d Chinese Han (Simplified variant)
測試 xn--g6w251d Chinese Han (Traditional variant)
испытание xn--80akhbyknj4f Russian Cyrillic
परीक्षा xn--11b5bs3a9aj6g Hindi Devanagari (Nagari)
δοκιμή xn--jxalpdlp Greek, Modern (1453-) Greek
테스트 xn--9t4b11yi5a Korean Hangul (Hangŭl, Hangeul)
טעסט xn--deba0ad Yiddish Hebrew
テスト xn--zckzah Japanese Katakana
பரிட்சை xn--hlcj6aya9esc7a Tamil Tamil

There are other "special use" domains that also cannot be registered or transferred. Make sure to check the linked documentation for each, as there may be restrictions on their use, such as the ".onion" domain with The Tor Project.

Example

If you wanted to document getting a specific resource via a REST API, you could document something like:

GET https://api.example.com/resources/item17
GET https://api.server.example/resources/item17

Phone Numbers

555 Exchange

The 555-0100 through 555-0199 numbers have been set aside for fictional use in North America, regardless of area code. Picking any area code using these 100 numbers cannot be called and are suitable for examples. Fictitious telephone numbers in other countries also exist, which include Australia, Germany, Hungary, Republic of Ireland, United Kingdom, Sweden, France, and South Korea.

Non-geographic Area Codes

Non-geographic area codes in North America prevent accidental preference to geographic locations, allowing the documentation to be non-preferential and unbiased. They include:

  • Personal Communication Service: 500, 521, 522, 523, 524, 525, 526, 527, 528, 529, 532, 533, 535, 538, 542, 543, 544, 545, 546, 547, 549, 550, 552, 553, 554, 556, 566, 558, 569, 577, 578, 588, 589
  • Interexchange carrier-specific services: 700
  • Toll-free call services: 800, 822, 833, 844, 855, 866, 877, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889
  • Premium call services: 900

While the area codes 600, 622, 633, 644, 655, 677, and 688 are identified as "non-geographic", they are assigned to Canada (666 is not assigned). The same applies to the 710 area code, which is assigned to the United States Federal Government. They should probably be excluded for documentation and examples if you wish to remain impartial to either the United States or Canada.

Example

If I wanted to demonstrate an Email-to-SMS gateway example in a PDF, I could use 5005550100@sms.example.com as an example so send an email as an SMS to (500) 555-0100 using the "sms.example.com" carrier.

IPv4 Addresses

Three class C networks have been set aside as "TEST-NET-1", "TEST-NET-2", and "TEST-NET-3". The IPv4 example address ranges are:

  • TEST-NET-1: 192.0.2.0/24
  • TEST-NET-2: 198.51.100.0/24
  • TEST-NET-3: 203.0.113.0/24

Note that these are not to be confused with RFC 1918 private IP addresses, which are reserved for private use.

Example

When giving an example of the BIND syntax for an A record, an example could look like:

example.com.			IN	A	192.0.2.1

IPv6 Addresses

Similar to IPv4, IPv6 has a range of addresses set aside explicitly for example use. It is:

  • 2001:db8::/32

Example

When giving an example of the BIND syntax for an AAAA record, an example could look like:

example.com.			IN	AAAA	2001:db8::1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment