400 Bad Request
4xx client error
The server can't process the request because something about it is malformed or invalid.
400 is the generic client error: something about the request is wrong, and sending it again unchanged will fail again. It covers broken syntax — invalid JSON, a malformed header — and many APIs also use it for validation failures. A useful 400 says exactly what was wrong in its body.
| Class | 4xx Client Error |
|---|---|
| Retry? | No — change the request first |
| Cacheable by default | No — only with explicit Cache-Control |
| Response body | Allowed |
| Defined in | RFC 9110 §15.5.1 — 400 Bad Request |
HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 23
{"error":"Bad Request"}Common causes
- Invalid JSON, or a body that doesn't match the
Content-Type. - Missing required query parameters or fields.
- Malformed or oversized cookies — nginx reports '400 Bad Request: Request Header Or Cookie Too Large'.
- Invalid characters in the URL, or a double-encoded URL.
How to fix it
- Validate the body: run
JSON.parseon it locally or paste it into a JSON validator. - Check that the
Content-Typematches the body (application/jsonfor JSON). - If one site fails in one browser, clear that site's cookies.
- On the server, return a machine-readable error naming the invalid field — RFC 9457
application/problem+jsonis a good format.
Useful here: JSON Validator · URL Encoder / Decoder
Send a 400 from your server
res.status(400).json({ error: "Bad Request" });return Response.json({ error: "Bad Request" }, { status: 400 });return {"error": "Bad Request"}, 400http.Error(w, "Bad Request", http.StatusBadRequest)
return 400;
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
400 vs 422?
400 when the request can't be parsed or is structurally wrong; 422 when it parses but the content fails validation, like an email field that isn't an email. Many APIs use 400 for both — just be consistent.
Why do I get 400 in one browser only?
Usually a corrupt or oversized cookie for that site. Clear the site's cookies and reload.