HTTP 400 — Bad Request
HTTP 400
Bad Request
The server could not understand the request because something about it is malformed.
What 400 actually means
The request itself is broken at a level the server refuses to guess about — bad syntax, a body that is not the JSON it claims to be, a header the server cannot parse, or a URL containing characters that should have been encoded. It is deliberately generic, which makes it the least helpful of the common errors: "400 Bad Request" alone tells you the server rejected the request but not which part offended it. Many APIs also use 400 for validation failures, though 422 is the more precise choice there.
Common causes
- Malformed JSON or XML in the request body — a trailing comma is the classic
- A required field missing or of the wrong type, where the API uses 400 for validation
- Invalid or unencoded characters in the URL or query string
- A corrupted or oversized cookie the server cannot parse
- Mismatch between `Content-Type` and the body actually sent
- An HTTP request sent to a port expecting HTTPS, or vice versa
If you're just trying to view the page
- Clear cookies for that site — an oversized or corrupted cookie is a very common cause of a 400 that follows you around
- Check the URL for typos, stray spaces, or characters that got mangled by copy and paste
- Try the page in a private window or a different browser to rule out local state
- Clear the browser cache and DNS cache if the error persists across pages on one site
If it's your site
- Return a body saying which field or header failed; a bare 400 wastes everyone's time
- Validate `Content-Type` and reject mismatches explicitly rather than failing to parse
- Check header and cookie size limits — Nginx `large_client_header_buffers` and equivalents reject oversize headers as 400
- Use 422 for semantically valid but unacceptable data, keeping 400 for genuinely unparseable requests
- Log the raw request when returning 400 so you can see what the client actually sent
Reference
- Status code
- 400
- Reason phrase
- Bad Request
- Category
- 4xx — Client Error
- Defined in
- RFC 9110 §15.5.1
Common questions
- What does HTTP 400 mean?
- The server could not understand the request because something about it is malformed. The request itself is broken at a level the server refuses to guess about — bad syntax, a body that is not the JSON it claims to be, a header the server cannot parse, or a URL containing characters that should have been encoded. It is deliberately generic, which makes it the least helpful of the common errors: "400 Bad Request" alone tells you the server rejected the request but not which part offended it.
- How do I fix a 400 error?
- Clear cookies for that site — an oversized or corrupted cookie is a very common cause of a 400 that follows you around
- Is 400 a client error or a server error?
- 400 is in the 4xx range, which means client error. The request itself was the problem, so retrying it unchanged will usually return the same code.
Related pages
- 404 Not Found The server is reachable and working, but there is nothing at the address you ask
- 403 Forbidden The server understood the request and is refusing to allow it, and logging in wi
- 401 Unauthorized You need to authenticate, and either you did not or your credentials were reject
- 429 Too Many Requests You have sent more requests than the service allows in a given period.
- 413 Content Too Large The request body is bigger than the server is willing to accept.
- 422 Unprocessable Content The request is well-formed and understood, but the data in it fails the rules.
- 405 Method Not Allowed The URL exists, but it does not accept the HTTP method you used.
- 409 Conflict The request cannot be completed because it clashes with the current state of the
- 415 Unsupported Media Type The server will not accept the format of the body you sent.
- 408 Request Timeout The server gave up waiting for the client to finish sending its request.
- 410 Gone The resource was deliberately removed and is not coming back, and there is no fo
- 451 Unavailable For Legal Reasons The content is blocked because of a legal demand — a court order, takedown notic