Not Found
4xx Client Error
Last updated:
The server has not found anything matching the requested URL.
Description
The most famous HTTP error. Signals that the resource doesn't exist, but says nothing about whether it ever existed or will exist again. Search engines treat 404 as a signal to eventually drop the URL from the index.
When to use
Return 404 for missing resources. Also acceptable to hide protected resources you don't want to acknowledge.
Common pitfalls
A 404 must return an actual 404 status. Serving a friendly 'not found' HTML page with a 200 status is called a 'soft 404' and confuses search engines.
Specification
RFC 9110 §15.5.5
Examples
HTTP response
HTTP/1.1 404 Not Found
Content-Type: application/json
{"error":"Not Found"}Node.js (Express)
res.status(404).json({ error: "Not Found" });Go (net/http)
w.WriteHeader(http.StatusNotFound)
Python (Flask)
return jsonify({"error": "Not Found"}), 404Related status codes
All 4xx codes
400 Bad Request401 Unauthorized403 Forbidden404 Not Found405 Method Not Allowed406 Not Acceptable408 Request Timeout409 Conflict410 Gone411 Length Required412 Precondition Failed413 Payload Too Large414 URI Too Long415 Unsupported Media Type418 I'm a teapot422 Unprocessable Entity425 Too Early428 Precondition Required429 Too Many Requests431 Request Header Fields Too Large451 Unavailable For Legal Reasons