413 Client Error πŸ“‹

413 Payload Too Large: Request Body Exceeds Server Limits

Last updated: June 28, 2026 β€’ 5 min read

✦ The Golden Answer: The 413 Payload Too Large status code (formerly "Request Entity Too Large") means the server refuses to process the request because the request body is larger than the server is willing or able to handle. This typically happens when uploading files, large JSON payloads, or submitting forms with excessive data. The fix is either to reduce the payload size (compress, split, or optimize) or to increase the server's payload limits.

Common Causes of 413 Errors

CauseExampleHow to Fix
File upload too largeUploading a 100 MB file when the server limit is 10 MB.Compress the file, split into chunks, or increase the server limit.
Large JSON payloadSending a 50 MB JSON payload to an API.Optimize the payload (remove unnecessary fields) or use pagination/streaming.
Form submission with many fieldsSubmitting a form with hundreds of fields or large text areas.Reduce the number of fields or use a more efficient data format.
CDN or proxy limitsCloudflare has a 100 MB upload limit (Enterprise plans can increase).Check your CDN/proxy limits and adjust your plan or use direct uploads.
Web server configurationNginx client_max_body_size set too low.Increase the limit in your web server configuration.

Example: 413 Response

When a client sends a request that exceeds the server's limit:

POST /upload HTTP/1.1 Host: example.com Content-Type: multipart/form-data Content-Length: 104857600 [100 MB of data...] HTTP/1.1 413 Payload Too Large Content-Type: text/html Content-Length: 123 <html> <body> <h1>413 Payload Too Large</h1> <p>The request entity is too large. Maximum allowed size is 10 MB.</p> </body> </html>

How to Increase Server Limits

ServerConfiguration DirectiveExample
Nginxclient_max_body_sizeclient_max_body_size 50M;
ApacheLimitRequestBodyLimitRequestBody 52428800 (50 MB in bytes)
PHP (php.ini)upload_max_filesize and post_max_sizeupload_max_filesize = 50M
post_max_size = 50M
CloudflarePlan limitsFree/Pro: 100 MB; Business: 200 MB; Enterprise: custom.
Node.js (Express)limit option in body-parserapp.use(express.json({ limit: '50mb' }));

Alternative Approaches

  • Chunked uploads – split large files into smaller chunks and upload sequentially.
  • Client‑side compression – compress data before sending (e.g., using gzip compression).
  • Direct upload to cloud storage – generate a signed URL and upload directly to S3 or similar, bypassing your server.
  • Streaming – use streaming uploads to handle large files without loading them entirely into memory.

When to Use 413 vs. 400

  • 413 Payload Too Large – the payload size exceeds a configured limit. The server can handle the request, but the payload is too big.
  • 400 Bad Request – the payload is malformed or invalid, regardless of size.

Frequently Asked Questions

Is 413 a client error or a server error?

It's a client error (4xx) because the client sent a payload that exceeds the server's configured limits. However, the fix may involve server-side configuration changes.

What is the maximum payload size for most servers?

It varies. Nginx and Apache default to 1 MB or 8 MB. Cloudflare has a 100 MB limit on Free/Pro plans. PHP defaults to 2 MB for uploads. Always check your specific server configuration.

Can I send a Retry-After header with 413?

Yes, you can include a Retry-After header to suggest when the client can try again (e.g., after increasing the limit or reducing the payload).