What 413 means
The request body is bigger than the server is willing or able to handle. It used to be called “Payload Too Large” and, before that, “Request Entity Too Large”.
When servers send it
For uploads or POST bodies over the server’s limit. If the limit is temporary, the server may add Retry-After.
Common causes
- nginx’s
client_max_body_size, which is only 1 MB by default. - PHP’s
upload_max_filesizeandpost_max_size. - A body size limit in your framework (Express’s
body-parserdefaults to 100 KB for JSON). - A limit at the CDN or load balancer in front of the app.
- Base64-encoding files in JSON, which makes them about a third bigger.
How to fix it as a developer
- Find which layer said no: the response’s
Serverheader and body usually tell you (nginx, your CDN, or your app). - Raise the limit at every layer, for example
client_max_body_size 50m;in nginx. - For big files, upload directly to object storage with a signed URL, or upload in chunks.
- Send files as multipart form data rather than base64 inside JSON.
How to fix it as a visitor
- Make the file smaller, for example by compressing an image or PDF, and try again.
Related codes
- 414 URI Too Long: The URL is longer than the server is willing to read.
- 431 Request Header Fields Too Large: The request headers are too big, very often because of too many or too large cookies.
- 400 Bad Request: The server can’t or won’t handle the request because something in it is malformed.
- 507 Insufficient Storage: The server doesn’t have room to store what the request needs it to. Mostly WebDAV.
Where it’s defined
413 Content Too Large is defined in RFC 9110, section 15.5.14. It’s a 4xx code, the client error class: something is wrong with the request, so sending it again unchanged won’t help.
Other 4xx codes
400 Bad Request · 401 Unauthorized · 402 Payment Required · 403 Forbidden · 404 Not Found · 405 Method Not Allowed · 406 Not Acceptable · 408 Request Timeout · 409 Conflict · 410 Gone · 414 URI Too Long · 415 Unsupported Media Type · 418 I’m a teapot · 422 Unprocessable Content · 429 Too Many Requests · 431 Request Header Fields Too Large · 451 Unavailable For Legal Reasons · 499 Client Closed Request
Or search them all in the HTTP status code list.
Questions people ask
What does HTTP 413 Content Too Large mean?
How do I fix 413 Request Entity Too Large in nginx?
client_max_body_size (default 1m) in the http, server or location block, for example client_max_body_size 50m;, then reload nginx. Check your app’s own limits too.