What Is a 400 Status Code?

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).


Rails HTTP Status Symbol bad_request

Go HTTP Status Constant http.StatusBadRequest

Symfony HTTP Status Constant Response::HTTP_BAD_REQUEST

Python2 HTTP Status Constant httplib.BAD_REQUEST

Python3+ HTTP Status Constant http.client.BAD_REQUEST

Python3.5+ HTTP Status Constant http.HTTPStatus.BAD_REQUEST

.NET HttpStatusCode.BadRequest

Rust http::StatusCode::BAD_REQUEST

Java java.net.HttpURLConnection.HTTP_BAD_REQUEST

Apache HttpComponents Core org.apache.hc.core5.http.HttpStatus.SC_BAD_REQUEST

Angular @angular/common/http/HttpStatusCode.BadRequest

400 status code example

Here is an example of a 400 status code:


POST /submit-form HTTP/1.1
Host: example.com
Content-Type: application/json
Content-Length: 30

{"name": "John", "age": "twenty"}


HTTP/1.1 400 Bad Request
Content-Type: text/plain
Content-Length: 13

Bad Request.

How to fix a 400 status code

To fix a 400 status code, you need to identify and correct the cause of the error.

Here are some common ways to fix a 400 status code:

  • Check the syntax of the request: A 400 status code is often caused by a malformed request. Check the syntax of the request to ensure that it conforms to the expected format.
  • Validate the request parameters: If the request contains parameters, validate them to ensure that they meet the expected requirements.
  • Update the API or web application: If the cause of the 400 status code is a bug or issue with the API or web application, update it to fix the problem.

What causes a 400 status code?

A 400 status code is typically caused by a client-side error, which means that the issue is with the request that the client sent to the server.

Here are some common causes of a 400 status code:

  • Malformed request syntax: The request sent by the client may be malformed, which means that it does not conform to the expected syntax or structure.
  • Invalid request parameters: The request may contain invalid parameters, such as missing or incorrect values.
  • Unsupported request method: The server may not support the HTTP method used in the request, such as PUT or DELETE.
  • Authentication issues: The client may not have the necessary credentials or permissions to access the resource.

Does a 400 Bad Request affect SEO?

Yes, a 400 status code can affect search engine optimization (SEO). Search engines may interpret a 400 status code as a sign that the website or web application has issues, which can affect the website’s search engine ranking. Additionally, if the 400 status code is caused by a broken link, search engines may not be able to crawl and index the affected page, which can also negatively impact SEO.

Additional resources

Return to List of HTTP Status Codes