HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

413 Content Too Large

Fault: Client
TL;DR

Request payload exceeds server's size limits.

The request content (body) is larger than the server is willing or able to process.

Specification note

RFC 9110 renamed 413 to "Content Too Large". Older names you will still see in error messages are "Payload Too Large" (RFC 7231) and "Request Entity Too Large" (RFC 2616).

What HTTP 413 Content Too Large Means

The request content (body) is larger than the server is willing or able to process.

Request payload exceeds server's size limits.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Upload Limits by Server

Server / layerSettingDefault
nginxclient_max_body_size1m
ApacheLimitRequestBodyDepends on version
PHPupload_max_filesize / post_max_size2M / 8M
IISrequestLimits maxAllowedContentLength (bytes)30,000,000 bytes
ASP.NET (System.Web)httpRuntime maxRequestLength (KB)4096 KB
Cloudflare proxyPlan upload limit100 MB on Free and Pro

Every layer in the chain must allow the size: raising PHP's limit does nothing if nginx in front of it still rejects the body.

# nginx (http, server or location block)
client_max_body_size 50m;

# php.ini
upload_max_filesize = 50M
post_max_size = 55M

"Maximum request length exceeded" in ASP.NET

The ASP.NET exception HttpException (0x80004005): Maximum request length exceeded means the request body exceeded maxRequestLength. On IIS you usually need to raise two values, and note that they use different units:

<system.web>
  <httpRuntime maxRequestLength="51200" />          <!-- KB = 50 MB -->
</system.web>
<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="52428800" />  <!-- bytes = 50 MB -->
    </requestFiltering>
  </security>
</system.webServer>

When only maxAllowedContentLength is exceeded, IIS answers with sub-status 404.13 instead of 413.

Returning a 413 Content Too Large (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 413 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(413).json({ error: 'Content Too Large' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Content Too Large'), 413

PHP

<?php
http_response_code(413);
header('Content-Type: application/json');
echo json_encode(['error' => 'Content Too Large']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 413 Content Too Large

Frequently Asked Questions

What does HTTP 413 Content Too Large mean?

Request payload exceeds server's size limits. In short: The request content (body) is larger than the server is willing or able to process.

Is 413 Content Too Large a client or server error?

413 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.

How do I fix a 413 Content Too Large error?

Increase client_max_body_size (Nginx). Increase LimitRequestBody (Apache). Increase upload_max_filesize (PHP).

Official Specification

The 413 Content Too Large status code is defined in RFC 9110 Section 15.5.14.

View the IANA HTTP Status Code Registry →