Write helpful error messages

Beginner  Nov 3, 2026

Say what happened, why and how to fix it, in plain words.

Write helpful error messages
The steps of this tutorial at a glance.
The steps of this tutorial at a glance.

Three parts of a good message

1. What happened: "We could not save your changes."
2. Why (if known): "Your connection was lost."
3. What to do: "Check your internet and try again."

Bad vs good

| Bad | Better |
|---|---|
| Error 500 | Something went wrong on our side. Please try again in a minute. |
| Invalid input | Enter your phone number with 11 digits, for example 03001234567. |
| Operation failed | We could not send your message. Your text is saved. Try again. |

Rules

  • Do not blame the user ("You entered a wrong value").
  • Avoid technical words and error codes in the main text.
  • Show the message next to the problem field, and also summarise at the top for long forms.
  • Do not rely on colour alone. Use an icon and text.
  • Keep what the user typed. Never clear the form on error.
  • Move focus to the first error for keyboard and screen reader users.
The main points of this section.
The main points of this section.

Prevent errors first

  • Show formats before typing ("DD/MM/YYYY").
  • Use the right input type.
  • Validate as the user leaves a field, not on every keystroke.
  • Offer undo instead of "Are you sure?" where possible.
The main points of this section.
The main points of this section.

Test

Trigger every error in your design on purpose. Read each message out loud. Would a tired visitor understand it?

More tutorials