# HTTP 413 Content Too Large — Meaning, Causes & Fixes

> The request body is bigger than the server is willing to accept.

413 means the body — usually an upload — exceeds a size limit. That limit is often not in your application at all but in front of it: nginx defaults to 1 MB (`client_max_body_size`), and hosting platforms cap request bodies too.

RFC 9110 renamed this status from 'Payload Too Large' (and earlier 'Request Entity Too Large') to 'Content Too Large'.

- Class: 4xx Client Error
- Retry: No — change the request first
- Cacheable by default: no
- Defined in: [RFC 9110 §15.5.14 — 413 Content Too Large](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.14)
- Also known as: Payload Too Large, Request Entity Too Large

## Example response

```http
HTTP/1.1 413 Content Too Large
Content-Type: application/json
Content-Length: 29

{"error":"Content Too Large"}
```

## Common causes

- An upload larger than nginx's `client_max_body_size` (default `1m`).
- Platform limits: Vercel Functions accept 4.5 MB bodies, AWS API Gateway 10 MB.
- Body-parser limits in the app — Express's `express.json()` defaults to `100kb`.
- Base64-encoding files inflates them by about a third, pushing them over the limit.

## How to fix it

1. Raise the limit at every layer: nginx (`client_max_body_size 20m;`), then the app's body parser.
2. Upload large files straight to object storage with a presigned URL instead of through your server.
3. Send files as `multipart/form-data`, not base64 inside JSON.

## Send a 413 from your server

### Express

```
res.status(413).json({ error: "Content Too Large" });
```

### Next.js route handler

```
return Response.json({ error: "Content Too Large" }, { status: 413 });
```

### Flask

```
return {"error": "Content Too Large"}, 413
```

### Go net/http

```
http.Error(w, "Content Too Large", http.StatusRequestEntityTooLarge)
```

### nginx

```
return 413;
```

## FAQ

### I raised my app's limit — why do I still get 413?

Something in front of the app has its own limit: nginx, a load balancer, an API gateway or the hosting platform. Check each hop; the smallest limit wins.

### What is nginx's default upload limit?

1 MB (client_max_body_size 1m). Set it in the http, server or location block and reload nginx.

## Related status codes

- [414 URI Too Long](https://www.devkult.com/http/414.md)
- [431 Request Header Fields Too Large](https://www.devkult.com/http/431.md)
- [400 Bad Request](https://www.devkult.com/http/400.md)

Open the interactive page: https://www.devkult.com/http/413