Lesson Weekend

After a server receives an HTTP request, it will respond with a message that consists of the following three elements:

  • Status
  • Headers
  • Body


The first line of a response message is the status which includes a status code and reason phrase. The HTTP status code is a three-digit number that indicates how the request was processed (or not). Each code is also accompanied by a reason phrase which is not read by the client but is intended to provide humans a brief description of the status code.

Below is a list of the five status code classes determined by the first digit of the code. This lesson shows the most common codes. To see a complete list, visit HTTP Status Codes.

1xx Informational

Status codes beginning with 1 indicate the request was received. This class of code is rarely used.

2xx Success

Status codes beginning with 2 indicate the request was received and handled successfully.


  • 200: OK

  • 201: Created

3xx Redirection

Status codes beginning with 3 indicate that additional action is required to complete processing the request.


  • 301: Moved permanently

  • 302: Moved temporarily

4xx Client errors

Status codes beginning with 4 indicate that something was wrong about the request.


  • 400: Bad Request (the request used invalid syntax)

  • 401: Unauthorized (you have to log in)

  • 403: Forbidden (you're logged in, but not allowed to make this request)

  • 404: Not Found

  • 422: Unprocessable (the request had valid syntax but the instructions it contained were invalid)

5xx Server Errors

Status codes beginning with 5 indicate that something went wrong on the server side, such as a bug in the code or a server that went down.


  • 500: Internal Server Error (usually a bug in the server code)

  • 502: Bad Gateway (the server sent the request to another server and got an invalid response)

  • 503: Service Unavailable (the server is overloaded or down for maintenance)


Like request headers, response headers include additional protocol providing more details about the HTTP response.

Some examples of response header fields include:

  • Server: The name of the server where the response is coming from.
  • Content-Language: The human language(s) of the content.
  • Content-Length: How long the response body is in 8-bit bytes.

For a list of all possible response headers, see here.


The response body includes all of the content for the resource requested. You'll often hear it referred to as the payload. When we issue a GET request for http://www.learnhowtoprogram.com/courses, we expect the body to include an HTML document with the table of contents for this curriculum. This resource may need additional resources such as images, CSS, script files, etc. For each resource, a new request is made by the client and a new response is issued for the resource from the server.

Once there is a response to all of the requests, the /courses resource is displayed in the browser.


  • Status code: First line of the response message from the server consisting of a three-digit number indicating the status of the request. Example: 200 indicates that the request was successfully processed.

  • Status reason: The human language interpretation of the status code, not read by the client but intended for humans.

  • Payload: The data that was requested in the original request message that is not protocol. Example: the payload for a request for the main page of a website would be the actual HTML document content.


Status Codes

  • 1xx Informational

  • 2xx Success

  • 3xx Redirection

  • 4xx Client errors

  • 5xx Server errors

Additional Resources

Complete List of HTTP Status Codes may be found here.