Skip to content

How to build a helpful 404 page

Reviewed on November 13, 2026

A good not-found page says plainly that the page wasn't found, then gives the visitor a way to carry on. Nothing fancy. A search box and a few links will do.

What a good 404 page doesVisitor asks for a missing addressServer sends a 404 status codeYour custom page loadsVisitor searches or picks a link
The page helps, and the status code still says "not found".

What to put on it

Start with a clear heading, such as "We can't find that page". Then add these:

  • One sentence on what likely happened: the page may have moved, been removed, or the address may have a typo.
  • A link back to your home page.
  • A short list of your main sections, or your most visited pages.
  • A search box, if your site has search. Wikipedia lists integrating search resources into 404 pages as one way to protect against dead links.1
  • A way to get in touch, for people who followed a broken link from your own site and want you to know.

Keep the site's normal header and menu. A visitor who lands on a bare page with no navigation is stuck.

Be clear, then be friendly

You can have some fun with it. MDN says custom 404 page design is a good thing in moderation.2

But it's also a warning. MDN says to feel free to make the page humorous and human, but not to confuse visitors about why they're seeing something unexpected.2 If a joke hides the fact that the page is missing, it's doing harm.

Say what's wrong first. Save the humour for the second line, if you use it at all.

Don't send the wrong status code

Here's the mistake that matters most. Your custom page must still send the proper not-found code behind the scenes.

Google calls it a soft 404 when a site shows a user-friendly "not found" message but not a 404 response code.3 Google's Page indexing report flags these, and Google recommends a real 404 response code for pages that truly aren't found.3

So the visitor sees a friendly page, and the status code still says "not found". Both matter.

Check yours. Type a made-up address on your own site and see what you get. If you've got a tool that shows status codes, confirm that it reports "not found". How status codes work explains what you're looking for.

Setting it up

How you do it depends on where your site lives.

On a website builder or a content management system, there's usually a setting or a template for the not-found page. Search its help pages for "error page" or "not found page". You shouldn't need to touch code.

On Apache servers, MDN says you can point to a custom 404 page from a .htaccess file. The directive is ErrorDocument 404 /notfound.html, and a common approach is to name the file 404.html or 404.php.2 The exact steps vary by server, so follow your host's own instructions. If you're not comfortable editing server files, ask your host's support.

What it can't do

A custom page doesn't fix broken links. It's a safety net for the ones you've missed. If a page has moved, a redirect is better, because the visitor lands where they wanted to go. For choosing between edit, redirect and remove, see this guide.

It can't help a visitor who never reaches it, either. If the whole site is down, that's a different problem. Server errors are the place to start, and this explainer covers it.

Look over your error page now and then. Click every link on it. It's easy to leave it with broken links of its own.

Where the facts come from

  1. Link rot, Wikipedia
  2. 404 Not Found - HTTP, MDN Web Docs
  3. Page indexing report, Google Search Console Help