Tech

Explainer

Updated

What does the HTTP 500 status code mean?

Key facts

Under RFC 9110, a client must treat an unrecognized 5xx code as a 500 and should treat a response with an invalid status code as a server error.

The HTTP 500 (Internal Server Error) status code means that the server encountered an unexpected condition that prevented it from fulfilling the request, according to RFC 9110, the IETF standard that defines HTTP semantics. In the words of Section 15.6.1 of RFC 9110, "The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request."

What the 5xx class means

RFC 9110 says the 5xx (Server Error) class indicates that the server is aware that it has erred or is incapable of performing the requested method, and that these status codes apply to any request method. Its list of classes sums up 5xx as "The server failed to fulfill an apparently valid request", which separates it from the 4xx class, where the request itself contains bad syntax or cannot be fulfilled. The site also explains 400 Bad Request and 404 Not Found, two codes in the 4xx class.

How 500 compares with other 5xx codes

RFC 9110 defines six server error codes, and the IANA registry lists each with the section that defines it.

CodeNameWhat RFC 9110 says it means
500Internal Server ErrorAn unexpected condition prevented the server from fulfilling the request
501Not ImplementedThe server does not support the functionality required to fulfill the request
502Bad GatewayA gateway or proxy received an invalid response from an inbound server
503Service UnavailableThe server cannot handle the request now because of a temporary overload or scheduled maintenance
504Gateway TimeoutA gateway or proxy did not receive a timely response from an upstream server
505HTTP Version Not SupportedThe server does not support, or refuses to support, the major HTTP version of the request

The meanings in the table are summarized from Sections 15.6.1 to 15.6.6 of RFC 9110. The IANA registry also lists 506 Variant Also Negotiates (RFC 2295), 507 Insufficient Storage (RFC 4918), 508 Loop Detected (RFC 5842) and 511 Network Authentication Required (RFC 6585), marks 510 Not Extended as obsoleted, and shows 509 and 512 to 599 as unassigned.

How 500 differs from 503

The 500 definition names no particular cause. A 503 (Service Unavailable) response is for a temporary overload or scheduled maintenance that will likely be alleviated after some delay, and the server may send a Retry-After header field with it to suggest how long the client should wait before retrying. The same section notes that a server does not have to use 503 when it becomes overloaded, and that some servers might simply refuse the connection.

Unknown and invalid codes are read as server errors

RFC 9110 says a client must understand the class of any status code from its first digit and treat an unrecognized code as equivalent to the x00 code of that class, so a client that receives an unregistered 5xx code handles it as a 500. The same section says all valid status codes are within 100 to 599, and that a client receiving a response with an invalid status code should process it as if it had a 5xx (Server Error) status code.

What a server should send with a 500

For all 5xx codes, RFC 9110 says that, except when responding to a HEAD request, the server should send a representation containing an explanation of the error situation and whether it is a temporary or permanent condition. It also says a user agent should display any included representation to the user.

Can a 500 be cached?

Not by heuristic expiration. The overview of status codes in RFC 9110 gives the heuristically cacheable codes in that specification, by way of example, as 200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414 and 501, and says all other status codes are not heuristically cacheable. That puts 500 outside the list, while 501 is inside it.

What changed and when

RFC 7231, published in June 2014, defined 500 in Section 6.6.1 with the same sentence RFC 9110 uses today. RFC 9110 was published in June 2022 on the Standards Track, carries the number STD 97 and obsoletes RFC 7231, as its header shows; the definition of 500 moved to Section 15.6.1 with its wording unchanged. The IANA registry now points code 500 to RFC 9110, Section 15.6.1, and shows its last update as September 15, 2025.

Have another question?