Error messages
Messages that tell people something has gone wrong, what exactly the problem is, and how to fix it.
Also called error recovery
Example
Instead of 'Invalid input', a payment form says 'The expiry date must be in the future' next to the expiry field, and keeps the card number already typed.
When to use it
Put the message next to the problem, describe it in plain words, suggest a fix, avoid blaming words like 'invalid', and keep what people already typed. Don't rely on colour alone.
The evidence 6 sourced claims
Every sentence on this card traces back to one of these claims, each linked to its source. How we research
WCAG 2.2 (level A) says that when an input error is detected automatically, the field with the problem must be pointed out and the error described in text. Colour can be used, but not on its own, and the standard does not fix where the message goes (next to the field, at the top, or in a dialog).
WCAG 2.2 (level AA) says that if a fix for an input error is known, the page should suggest it, unless that would weaken security or the purpose of the content. For example, if someone types '12' where a month name is needed, the page can list the month names or ask if they meant December.
Nielsen's ninth heuristic says error messages should use plain language with no error codes, say exactly what the problem is, and suggest a way to fix it.
Good error messages sit next to the thing that caused the problem, are easy to notice without relying on colour alone, describe the specific problem in plain words, suggest a next step, keep a neutral tone without blaming words like 'invalid', and keep what the person already typed so they can edit it instead of starting again.
The UK government's design system shows each error next to its field and also lists all errors in a summary at the top of the page. Messages should say what happened and how to fix it, reuse words from the question, and be specific (for example 'Enter your name' rather than 'This field is required'), avoiding words such as 'invalid', 'oops', 'please' and 'sorry'.
Five early studies of compiler and text-editor error messages found that making messages more specific, more positive in tone and clearer helped people fix their errors more often and made them more satisfied.