Skip to content
HTTP 413 Payload Too Large — What It Means & How to Fix

HTTP 413 Payload Too Large — What It Means & How to Fix

DodaTech Updated Jun 20, 2026 4 min read

HTTP 413 Payload Too Large is an HTTP response status code that indicates the server refuses to process the request because the request body (payload) exceeds the server’s defined size limit. This typically happens during file uploads or when submitting large JSON payloads to an API.

What It Means

Defined in RFC 7231 Section 6.5.11, the 413 status code tells the client: “Your request is too large. Reduce its size and try again.” The server sets a limit on the request body size to protect against resource exhaustion attacks and to manage server capacity.

The response may include a Retry-After header if the limit is temporary, and the body may indicate the maximum allowed size.

When It’s Sent

  • File uploads — A user tries to upload a 50 MB video to a service that limits uploads to 10 MB.
  • Large JSON payloads — An API client sends a request body containing massive amounts of JSON data.
  • Form submissions — A multipart form with many fields or large file attachments exceeds the limit.
  • Base64-encoded data — Data URLs or base64-encoded images in API requests can quickly exceed payload limits.
  • XML/RPC requests — Legacy protocols sending large XML payloads to web services.

Real Example

The following curl command sends a large payload to trigger a 413 response:

curl -X POST https://httpbin.org/post \
  -H "Content-Type: application/json" \
  -d "$(python3 -c 'print("x" * 1000000)')" \
  -w "\nHTTP Status: %{http_code}\n"

Expected response:

HTTP/1.1 413 PAYLOAD TOO LARGE
Date: Sat, 20 Jun 2026 12:00:00 GMT
Content-Type: application/json
Content-Length: 109

{
  "message": "Request body too large. Maximum size: 1 MB."
}

How to Debug & Fix

Client-Side

  1. Check the file size — Before uploading, verify the file is under the documented limit. Resize images or compress files.
  2. Split large payloads — If sending bulk data, batch the requests into smaller chunks.
  3. Use chunked transfer encoding — Some servers allow streaming large payloads in chunks.
  4. Compress the request body — Send Content-Encoding: gzip to reduce payload size.
  5. Check for base64 bloat — Base64 encoding increases size by ~33%. Use binary formats instead.

Server-Side

  1. Increase the limit — If the limit is too restrictive for legitimate use cases, increase it in your server config.
  2. Return a clear error — Include the maximum allowed size in the response body or Retry-After header.
  3. Stream large uploads — Use streaming to process large files without buffering the entire payload.
  4. Set per-route limits — Allow larger limits for specific endpoints that need it (e.g., /api/upload).

Common Causes Table

ScenarioLikely CauseHow to Fix
File upload fails at 5 MBnginx client_max_body_size default is 1 MBIncrease client_max_body_size in nginx config
API JSON payload rejectedExpress/Flask body parser default limitSet limit option on body parser middleware
Large image upload failsApplication-level limit in server codeCheck upload_max_filesize in php.ini or equivalent
Base64 image rejectedBase64 inflates size by 33%, hitting the limitUse binary upload or increase the limit proportionally
Form with many fields failsCombined size of fields exceeds maxInputVarsIncrease max_input_vars or reduce number of fields

FAQ

What is the default payload size limit for common servers?
nginx defaults to 1 MB (client_max_body_size), Apache to 2 GB (LimitRequestBody is unlimited by default), Node.js Express to 100 KB, and Python Flask to 16 KB for JSON.
Can I resume a failed 413 upload?
Not with the standard 413 itself. You need client-side logic (like tus resumable upload protocol) or chunked uploads to split the file and send each chunk as a separate request.
Does 413 apply to headers too?
No. Header size limits are reported as 431 Request Header Fields Too Large. The 413 is specifically about the request body (payload).

Related Codes

HTTP 431 Request Header Fields Too Large — The request headers exceed server limits.

HTTP 400 Bad Request — The server cannot process the request due to client error.

HTTP 507 Insufficient Storage — The server cannot store the resource.

HTTP 429 Too Many Requests — Rate limiting, often combined with body size checks.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro