Postel's law

What is Postel's law?

Postel's law - the robustness principle - says be conservative in what you send and liberal in what you accept. Take input in whatever shape people naturally give it, then tidy it up yourself, instead of rejecting anything that isn't already perfectly formatted.

Also known as: robustness principle, be liberal in what you accept, postels law

Prefer to watch? Watch the recap 0:36

The demo

Type a phone number however you like, then submit it. One field is strict about the format; the other accepts whatever you give it and tidies it up.

Strict mode: this field only accepts "01234 567890" - digits, one space, nothing else. Try submitting the messy number above.

What this demo shows (text version)

A phone-number field, pre-filled with "(01234) 567 890" - a number any human reads instantly. In "strict" mode the field only accepts one exact format ("01234 567890"), so submitting the pre-filled value is rejected for its brackets and spaces.

In "forgiving" mode the same value is accepted: the field strips the brackets and spaces, recognises the eleven digits, and stores a tidy "01234 567890". The number and the intent are identical either way - the only difference is whether the form does the tidying or makes the person do it. That is Postel's law: be conservative in what you send, liberal in what you accept.

People type things their own way - spaces, brackets and dashes in a phone number; slashes or words in a date. Accept all of it and normalise behind the scenes; rejecting input for being the "wrong format" just pushes the machine's fussiness onto the person, who only wanted it to work.

Liberal isn't limitless. "Accept anything" means accept any reasonable format, then still validate the essentials - that it is a phone number, that the card passes a checksum, that the date exists. Normalise first, then check meaning; never skip the check, and never accept input that's unsafe to store or display.

The cost of fussiness is invisible but real: every rejected "0123 456 789" is a person retyping something that was already correct, or abandoning the form. The parsing is a one-time job for you; the formatting tax, multiplied across every user, is theirs forever. Tesler's law in miniature - the system should carry it.