Write a clear error message

“This field is required” or “Fill out this field” doesn’t provide enough information for a user. A custom-written error message gives the user much more guidance.

Help the user

Never blame the user if they don’t understand the error message. Most people struggle with the amount of information and functionality on the web. Help users as much as possible to successfully submit the form.

Therefore, make error messages as descriptive and tailored as possible. Instead of “Invalid input” or “This field is required,” for example, write:

For example:

  • Enter a valid email address, for example name@example.com.
  • The expiration date of your passport must be in the future.
  • Please enter your email address, so we can send you the confirmation of your appointment.

Tip: Use a period . at the end of the error message (or any other message). This causes the screen reader to pause briefly and makes it clearer that the error message is a separate sentence.

The GOV.UK design system provides clear (English-language) guidance on error message text: Be clear and concise. In the video Help Users Recognize, Diagnose, and Recover from Errors, the Nielsen Norman Group gives tips on how to effectively help users fix errors.

Writing error message texts that clearly explain what went wrong is required to meet the following WCAG success criteria:

Resources