Write errors people can fix
“Invalid input” tells people they failed. A good error message tells them how to succeed.
On this page
An error message is the moment your product talks to someone who is already a little frustrated. Most products choose that moment to be vague, technical or slightly accusing.
Say what happened and what to do
Every error needs two things: what went wrong, in plain words, and how to fix it. “Invalid date” is half a message. “Please enter the date as DD.MM.YYYY” is a whole one. If the system knows the answer, it should not make people guess.
Put it where the problem is
An error belongs next to the field it is about, and it stays until the problem is solved. A red list at the top of the page sends people searching. Do not rely on red alone either: add an icon and text, so everyone can see it.
At the field, with the fix, input kept
A banner on top, and everything cleared
And at the right time
Do not shout while people are still typing. Check a field when they leave it, and confirm when it is right. And never clear what they already entered because one field was wrong.
Mark what is optional
Some errors can be prevented before anyone types. Most forms put a red star on every required field. The form starts to look like a list of warnings, and the star only works for people who find its legend. Usually almost every field is required anyway, so mark the exception: add “(optional)” to the few fields people can skip. A word needs no legend.
Only the exception is marked, in words
* Required field
A star on every field, explained in a legend
In the code, required fields keep their required attribute, so screen readers still announce them. And before you add an optional field, ask if you need it at all.
Read your error messages out loud. If one would sound rude said across a desk, rewrite it.
Sources
- Nielsen Norman Group: Error-Message Guidelines
- Baymard Institute: Usability Testing of Inline Form Validation
- W3C: Understanding WCAG 2.1: Error Suggestion
- GOV.UK Design System: Question pages