What is a 404 error code and how to fix it
Discover what a 404 error code means, why it happens, and practical steps to diagnose, fix, and prevent not found errors on websites and APIs. Learn about SEO implications and how to design user friendly solutions.

An HTTP status code indicating that the requested resource could not be found on the server.
What is a 404 error code and what does it mean?
The 404 error is an HTTP status code in the 4xx family that signals a requested resource could not be found on the server. In plain terms, the browser asked for a page, image, or API endpoint that the server could not locate at the specified URL. Unlike a 500 internal server error, which points to a problem on the server, a 404 indicates the resource is missing or unreachable from the given address.
Not Found does not guarantee the resource never existed; it can mean the page has moved, was renamed, or was never created. Different servers and frameworks produce their own descriptive 404 pages, but the core meaning stays the same: the client can communicate with the server, but the specific resource isn’t available at the requested location.
From an API perspective, 404 is used for endpoints that do not exist or for objects that aren’t present. For developers, this often means the routing or URL mapping needs adjustment, or a missing test fixture is being requested. Understanding when a 404 happens helps you decide between correcting a link, returning a friendlier message, or rerouting to a relevant resource.
Common causes of 404 errors
404 errors are typically user facing, but they often stem from how content is managed and linked. Here are the most common culprits:
- Broken or outdated links: Internal links that point to pages that have moved or were removed.
- Moved or renamed resources: A page or asset was relocated without updating links or redirects.
- Typos in the URL: A simple misspelling or wrong case can lead to a Not Found page.
- Missing trailing slash or leading path differences: Some servers treat /page and /page/ as different resources.
- Dynamic routes and parameters: URLs that rely on parameters may generate 404s if the expected data is absent.
- Content migrations and CMS changes: During site refreshes, some paths may be left behind without redirects.
Recognizing these patterns helps you fix the root cause rather than merely masking the symptom.
How servers decide to return a 404
Servers determine Not Found responses during the routing and resource resolution phase. If a request cannot be matched to any file, route, or API endpoint, the server returns a 404 status with a page stating that the resource could not be found. Variations exist across frameworks, but the essence is consistent: the requested path is not available.
There is also a concept called soft 404, where a server returns a 200 status with a page that says Not Found. This is considered bad practice because it misleads crawlers. Proper 404 responses should return the 404 status code to signal to clients and search engines that the resource is missing.
For developers, distinguishing between missing resources and access restrictions (such as a protected resource returning 403) is important, because it informs both user messaging and automated handling of the error.
How to diagnose 404s on your website
Diagnosing 404s involves a mix of logs, tooling, and manual checks. Start with these steps:
- Check web server logs (Apache, Nginx) to identify which URLs return 404 and when.
- Test the URL with a browser, a curl request, or Postman to confirm the status code and headers.
- Crawl the site with a tool (for example, a dedicated SEO crawler) to surface internal broken links.
- Review CMS migrations and routing configurations to ensure paths still map to resources.
- Inspect your sitemap and robots.txt to verify they don’t hide or misdirect critical pages.
- Examine redirect chains to ensure there are no loops or dead ends that lead to 404s.
By combining logs, crawlers, and manual checks, you can pinpoint the exact source of 404s and apply the right remedy.
User experience considerations and fixes
A well designed 404 page is part of the user experience, not an afterthought. Consider the following practices:
- Show a friendly message that explains the page couldn’t be found without blaming the user.
- Include a prominent search box and links to popular pages or the homepage.
- Avoid exposing internal site structure or error details in the message.
- Consider offering related content or a site map to help users recover quickly.
- Ensure the 404 page itself returns a true 404 status to avoid confusing crawlers.
- Use clear language and branding to keep trust intact after an error.
For content that has moved, use 301 redirects to the new location rather than a 404. This preserves user flow and search equity while guiding visitors to the right destination.
SEO implications of 404 errors
Search engines treat 404s as signals that a page is no longer available. If a page truly doesn’t exist, a 404 is appropriate and safe for SEO. What matters is how you handle 404s:
- Avoid soft 404s by returning the correct 404 status instead of a page that says Not Found but loads with 200.
- Use 301 redirects for moved resources to preserve link equity when pages are intentionally removed or relocated.
- Keep a clean crawl budget by removing or redirecting irrelevant 404s, especially on large sites.
- Update internal links and sitemaps to reflect current structure so search engines discover valid content.
In short, 404s are not inherently harmful if managed properly. The impact depends on how quickly you diagnose and resolve them and how well you guide users to relevant content.
Best practices for preventing 404 errors
Proactive prevention reduces the frequency of Not Found pages:
-Regularly audit internal links and fix broken ones. -Implement 301 redirects for any moved or renamed resources. -Maintain an up to date sitemap and submit it to search engines. -Create a user friendly 404 page that helps visitors recover quickly. -Set up automated monitoring for spikes in 404s and respond promptly. -Use version control and a content inventory to track where resources live. -Ensure that dynamic routes have fallback logic so expected data does not produce 404s.
With these practices, you can keep user experience high and SEO healthy, even during site changes.
Tools and resources for debugging 404 errors
When chasing Not Found errors, leverage both browser tools and external services:
- Browser developer tools for inspecting network requests and response headers.
- curl or wget for quick status checks from the command line.
- Google Search Console and Bing Webmaster Tools to surface crawl errors.
- Screaming Frog or similar site crawlers to find broken links at scale.
- Content inventory tools to map pages to resources and redirects.
- Uptime monitors to flag 404s during live operation.
Combining these tools gives you a robust view of where 404 errors originate and how to fix them efficiently.
Frequently Asked Questions
What is a 404 error code?
A 404 error is an HTTP status code that means the server could not locate the requested resource. It indicates the page or asset is missing at the given URL, not that the server itself failed. It is one of several client error responses in the 4xx range.
A 404 error means the page you asked for can’t be found on the server. It’s a not found error indicating the resource is missing at that URL.
How is a 404 different from a 403 or a 410?
A 404 means not found and is typically used when a page is missing. A 403 means access is forbidden because of permissions. A 410 means the resource is gone permanently and is not expected to return. Each status communicates a different condition to clients and crawlers.
404 means not found, 403 means access denied, and 410 means gone permanently. They have different implications for users and search engines.
Should you always redirect 404s?
Redirects are appropriate when the content has moved to a new URL. If there is no good destination, it is better to serve a proper 404 page with helpful navigation rather than a misleading redirect. Avoid redirect chains that create more 404s.
Redirect only when there is a clear new place for the content. If not, keep a proper 404 page with helpful options.
How can I fix a broken internal link on my site?
Identify the broken link through logs or crawlers, update the URL to the correct destination, or remove the link if the content is permanently gone. After updating, re-crawl the site to confirm the issue is resolved.
Locate the broken link, correct or remove it, then re-crawl to verify it’s fixed.
How do I test for 404s on my site?
Use command line tools like curl to fetch URLs and inspect status codes, run site crawlers to surface broken links, and check your server logs for 404 entries. Regular checks help catch issues before users do.
Run curl to check URLs and crawl your site to find 404s, then fix them promptly.
Can a 404 hurt my site’s SEO?
404s themselves are not forbidden by search engines, but a high number of broken links can hurt crawl efficiency and user experience. Fix critical 404s quickly and use redirects where appropriate to maintain SEO value.
404 errors can affect crawl efficiency and UX, so fix them quickly and use redirects when content moved.
Top Takeaways
- Audit internal links regularly to catch broken paths
- Use clear and helpful 404 pages to guide users
- Prefer 301 redirects for moved content over leaving 404s
- Ensure 404 pages return the correct 404 status code
- Monitor and fix 404s to protect UX and SEO