CodeToolProCodeToolProFree Online Developer Tools
GitHub

HTTP Status Codes

1xx Informational(100-199)

CodeNameDescription
100ContinueThe server has received the request headers and the client should proceed to send the request body.
101Switching ProtocolsThe requester has asked the server to switch protocols and the server has agreed to do so.
102ProcessingThe server has received and is processing the request, but no response is available yet (WebDAV).
103Early HintsUsed to return some response headers before final HTTP message.

2xx Success(200-299)

CodeNameDescription
200OKThe request has succeeded. The meaning depends on the HTTP method.
201CreatedThe request has been fulfilled and a new resource has been created.
202AcceptedThe request has been accepted for processing, but the processing has not been completed.
203Non-Authoritative InformationThe returned metadata is not exactly the same as available from the origin server.
204No ContentThe server successfully processed the request, but is not returning any content.
205Reset ContentThe server successfully processed the request, asks that the requester reset its document view.
206Partial ContentThe server is delivering only part of the resource due to a range header sent by the client.
207Multi-StatusThe message body that follows is an XML message with multiple independent response codes (WebDAV).
208Already ReportedThe members of a DAV binding have already been enumerated (WebDAV).
226IM UsedThe server has fulfilled a request for the resource, and the response is a representation of the result.

3xx Redirection(300-399)

CodeNameDescription
300Multiple ChoicesIndicates multiple options for the resource.
301Moved PermanentlyThe requested resource has been permanently moved to a new URI.
302FoundThe requested resource has been temporarily moved to a different URI.
303See OtherThe response to the request can be found under another URI using the GET method.
304Not ModifiedThe resource has not been modified since the version specified by the request headers.
305Use ProxyThe requested resource must be accessed through the proxy given by the Location field.
307Temporary RedirectThe request should be repeated with another URI, but future requests should still use the original URI.
308Permanent RedirectThe request and all future requests should be repeated using another URI.

4xx Client Error(400-499)

CodeNameDescription
400Bad RequestThe server cannot process the request due to a client error (malformed syntax).
401UnauthorizedAuthentication is required and has failed or has not yet been provided.
402Payment RequiredReserved for future use. Originally intended for digital payment systems.
403ForbiddenThe server understood the request, but is refusing to fulfill it.
404Not FoundThe requested resource could not be found on the server.
405Method Not AllowedThe request method is not supported for the requested resource.
406Not AcceptableThe requested resource is capable of generating only content not acceptable according to the Accept headers.
407Proxy Authentication RequiredThe client must first authenticate itself with the proxy.
408Request TimeoutThe server timed out waiting for the request.
409ConflictThe request could not be processed because of conflict in the current state of the resource.
410GoneThe requested resource is no longer available and will not be available again.
411Length RequiredThe request did not specify the length of its content, which is required by the requested resource.
412Precondition FailedThe server does not meet one of the preconditions that the requester put on the request.
413Payload Too LargeThe request is larger than the server is willing or able to process.
414URI Too LongThe URI provided was too long for the server to process.
415Unsupported Media TypeThe request entity has a media type which the server or resource does not support.
416Range Not SatisfiableThe client has asked for a portion of the file, but the server cannot supply that portion.
417Expectation FailedThe server cannot meet the requirements of the Expect request-header field.
418I'm a teapotThe server refuses the attempt to brew coffee with a teapot (April Fools' joke, RFC 2324).
421Misdirected RequestThe request was directed at a server that is not able to produce a response.
422Unprocessable EntityThe request was well-formed but was unable to be followed due to semantic errors (WebDAV).
423LockedThe resource that is being accessed is locked (WebDAV).
424Failed DependencyThe request failed because it depended on another request and that request failed (WebDAV).
425Too EarlyThe server is unwilling to risk processing a request that might be replayed.
426Upgrade RequiredThe client should switch to a different protocol.
428Precondition RequiredThe origin server requires the request to be conditional.
429Too Many RequestsThe user has sent too many requests in a given amount of time (rate limiting).
431Request Header Fields Too LargeThe server is unwilling to process the request because its header fields are too large.
451Unavailable For Legal ReasonsThe server is denying access to the resource as a consequence of a legal demand.

5xx Server Error(500-599)

CodeNameDescription
500Internal Server ErrorThe server encountered an unexpected condition that prevented it from fulfilling the request.
501Not ImplementedThe server does not support the functionality required to fulfill the request.
502Bad GatewayThe server received an invalid response from an upstream server.
503Service UnavailableThe server is currently unable to handle the request due to temporary overloading or maintenance.
504Gateway TimeoutThe server did not receive a timely response from an upstream server.
505HTTP Version Not SupportedThe server does not support the HTTP protocol version used in the request.
506Variant Also NegotiatesTransparent content negotiation results in a circular reference.
507Insufficient StorageThe server is unable to store the representation needed to complete the request (WebDAV).
508Loop DetectedThe server detected an infinite loop while processing the request (WebDAV).
510Not ExtendedFurther extensions to the request are required for the server to fulfill it.
511Network Authentication RequiredThe client needs to authenticate to gain network access.

技术详情

HTTP 状态码速查表

工具功能

HTTP 状态码速查表列出了所有 IANA 注册的 HTTP 响应状态码,按 RFC 标准分类为 5 组(1xx-5xx)。每个状态码包含数字代码、原因短语、RFC 来源、详细说明和开发者实用指南。支持按类别筛选(信息、成功、重定向、客户端错误、服务器错误)和关键词搜索(如 "Not Found" 或 "429")。同时标注哪些状态码是标准必知的(如 200、301、404、500),哪些是非常见但有用的(如 418 I'm a teapot 的趣闻背景)。


常见开发者使用场景

HTTP 状态码速查表是每个 Web 开发者的必备参考。后端开发者在设计 RESTful API 时,正确选择状态码是 API 设计质量的关键——400 Bad Request vs 422 Unprocessable Entity 的选择体现了 API 设计的专业程度。前端开发者处理 API 响应时需要理解各类状态码的含义,特别是 401 vs 403 的区别(未认证 vs 已认证但无权限)。DevOps 在监控应用时根据 5xx 错误的出现频率判断服务器健康状况。面试中关于状态码的问题是高频考点。

配合 MIME 类型参考 了解 HTTP Headers 中的 Content-Type,或使用 API 测试器 实际测试各类状态码的 API 响应。


HTTP 状态码 5 大分类详解

所有状态码按百位数分组,每组有明确的语义:

  • 1xx 信息性:100 Continue(继续发送请求体)、101 Switching Protocols(WebSocket 升级)。很少在应用层直接使用。
  • 2xx 成功:200 OK(标准成功)、201 Created(资源创建成功)、204 No Content(成功但无返回体,常用于 DELETE)。
  • 3xx 重定向:301 Moved Permanently(永久重定向/SEO 迁站)、302 Found(临时重定向)、304 Not Modified(缓存命中)。
  • 4xx 客户端错误:400 Bad Request(请求格式错误)、401 Unauthorized(需要认证)、403 Forbidden(无权访问)、404 Not Found(不存在的资源)、429 Too Many Requests(限流)。
  • 5xx 服务器错误:500 Internal Server Error(未捕获的服务器异常)、502 Bad Gateway(上游服务错误)、503 Service Unavailable(维护或过载)。

常见陷阱与注意事项

  • 401 vs 403 的区别:401 表示"请先登录"(未认证),会触发浏览器弹出认证对话框。403 表示"你已经登录,但没有权限"(已认证但无授权)。这是最常混淆的两个状态码。
  • 200 vs 204:DELETE 操作成功后返回 204 No Content 更语义化(确实没有内容返回),返回 200 也可以但不够精确。
  • 自定义状态码:不要在项目中发明自定义状态码。虽然技术可行性存在,但它破坏了 HTTP 协议的标准化语义,导致通用中间件和监控工具无法正确解读。
  • 418 I'm a teapot:这来自 1998 年愚人节 RFC 2324(超文本咖啡壶控制协议),但许多框架至今保留了这个状态码作为内部玩笑。

何时使用此工具而非代码

在 API 设计决策时选择正确的状态码、排查 HTTP 错误的含义、或准备技术面试时使用此参考表。