# 413 Payload Too Large in Express

> Fix an Express 413: raise the express.json limit from its 100kb default, read the entity.too.large error, handle multer limits and check the proxy in front.

Canonical: https://scaplet.com/errors/http/413/express

Guide Error · HTTP status codes

Fix an Express 413: raise the express.json limit from its 100kb default, read the entity.too.large error, handle multer limits and check the proxy in front.

3 min

read

7

sources

Oct 29, 2026

updated

Scaplet Editorial Team

author

413 4xx · Client error

The short answer

In Express a 413 comes from body parsing. `express.json()` and `express.urlencoded()` reject bodies over their `limit`, which defaults to `'100kb'`, with an error whose `status` is 413 and `type` is `'entity.too.large'`. Raise the limit on the route that needs it, or move uploads to multer, and check any proxy in front.

1. [The error and where it comes from](#the-error-and-where-it-comes-from)
2. [Fix it on the route that needs it](#fix-it-on-the-route-that-needs-it)
3. [Multipart uploads use multer](#multipart-uploads-use-multer)
4. [Check what is in front of Express](#check-what-is-in-front-of-express)
5. [Test the limit without guessing](#test-the-limit-without-guessing)

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fexpress%20(%22413%20Payload%20Too%20Large%20in%20Express%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fexpress%20(%22413%20Payload%20Too%20Large%20in%20Express%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fexpress%20(%22413%20Payload%20Too%20Large%20in%20Express%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fexpress%20(%22413%20Payload%20Too%20Large%20in%20Express%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

_01_body-parser options that can return 413

## The error and where it comes from

body-parser documents this exact case: "This error will occur when the request body's size is larger than the "limit" option". The error carries `limit` and `length` properties, with `status` set to `413` and `type` set to `'entity.too.large'`. Express's default error handler sets the response status from `err.status`, so the client sees 413 unless you handle it.

Option

### `limit`

Default

`'100kb'`

What it limits

Maximum request body size, as bytes or a string such as `'5mb'`

Option

### `parameterLimit` (urlencoded)

Default

1000

What it limits

Number of parameters; more returns a 413

The docs recommend not setting a very high limit: payloads above the default, and "payloads of 5 MB or more" in their example, increase memory use and response times.

_02_Check it

## Fix it on the route that needs it

Order matters: a parser mounted earlier on a path handles the body first. Mount the high-limit parser on the specific path before the global one, as above, so large payloads are not rejected by the default parser.

Return a useful 413 instead of the default page

```
app.use((err, req, res, next) => { if (err.type === 'entity.too.large') { return res.status(413).json({ error: 'Body too large', limit: err.limit }); } next(err); });
```

Small default globally, larger limit only where needed

```
import express from 'express'; const app = express(); // everything else stays at the 100kb default app.use('/import', express.json({ limit: '5mb' })); app.use(express.json()); app.post('/import', (req, res) => res.json({ ok: true }));
```

_03_Good to know

## Multipart uploads use multer

`express.json()` does not parse multipart forms. File uploads usually go through multer, which has its own `limits`. Its `fileSize` default is `Infinity`, `fieldSize` is 1MB, and exceeding a limit raises a `MulterError` with a code such as `LIMIT_FILE_SIZE`. That error is not an `entity.too.large` error, so handle it separately.

multer with a size limit and error handling

```
import multer from 'multer'; const upload = multer({ dest: 'uploads/', limits: { fileSize: 10 * 1024 * 1024 } }); app.post('/avatar', (req, res) => { upload.single('avatar')(req, res, (err) => { if (err instanceof multer.MulterError) { return res.status(413).json({ code: err.code }); } if (err) return res.status(500).end(); res.json({ ok: true }); }); });
```

Never mount multer globally

The multer docs warn to never add it as global middleware, since a user could upload files to a route you did not set up.

_04_How it works

## Check what is in front of Express

Other 413 sources in a typical stack
| Layer | Where to look |
| nginx | `client_max_body_size`, default `1m`; see [413 in nginx](/errors/http/413/nginx) |
| Apache | `LimitRequestBody`; see [413 in Apache](/errors/http/413/apache) |
| IIS | `maxAllowedContentLength`; see [413 in IIS](/errors/http/413/iis) |

1. 01

### Reproduce

`curl -i -X POST -H 'Content-Type: application/json' --data-binary @big.json http://localhost:3000/import`.
2. 02

### Read the headers

A 413 with an HTML body and a `Server: nginx` header came from the proxy, not Express.
3. 03

### Hit Express directly

Call the app port without the proxy. If it passes, raise the proxy limit instead of the parser limit.

_05_Check it

## Test the limit without guessing

With the default limit you should see your route's normal status for the first file and `413` for the second. If both fail, something other than body-parser is rejecting the request. If both pass, your limit is higher than you think, so look for another `express.json()` call earlier in the stack.

- **Wrong content type**: a parser only reads bodies whose `Content-Type` matches its `type` option, so a mismatched type leaves `req.body` undefined rather than returning 413.

Generate bodies just under and just over 100kb

```
node -e "console.log(JSON.stringify({d:'x'.repeat(90*1024)}))" > under.json node -e "console.log(JSON.stringify({d:'x'.repeat(110*1024)}))" > over.json curl -s -o /dev/null -w '%{http_code}\n' -X POST -H 'Content-Type: application/json' --data-binary @under.json http://localhost:3000/ curl -s -o /dev/null -w '%{http_code}\n' -X POST -H 'Content-Type: application/json' --data-binary @over.json http://localhost:3000/
```

_06_Explained

## SEO and crawler notes

This is an API and form problem. [Googlebot](/ai-crawlers/googlebot) sends GET requests without bodies, so it normally never hits the body limit. Google treats any 4xx other than 429 the same way: it does not index the URL. See [413 Request Entity Too Large](/errors/http/413).

Sources · 7

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- rfc-editor.org
- expressjs.com
- githubusercontent.com
- google.com

1. 01 [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html) rfc-editor.org · checked 2026-11-01
2. 02 [Express: body-parser middleware](https://expressjs.com/en/resources/middleware/body-parser.html) expressjs.com · checked 2026-11-01
3. 03 [body-parser README](https://raw.githubusercontent.com/expressjs/body-parser/master/README.md) raw.githubusercontent.com · checked 2026-11-01
4. 04 [Express: error handling](https://expressjs.com/en/guide/error-handling.html) expressjs.com · checked 2026-11-01
5. 05 [Express: multer middleware](https://expressjs.com/en/resources/middleware/multer.html) expressjs.com · checked 2026-11-01
6. 06 [multer README](https://raw.githubusercontent.com/expressjs/multer/master/README.md) raw.githubusercontent.com · checked 2026-11-01
7. 07 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-11-01

Questions

## Asked a lot.

3 questions people ask next, answered from the sources on this page.

_01_ What is the default body size limit in Express?

`express.json()` and `express.urlencoded()` use body-parser, whose `limit` option defaults to `'100kb'`. Bodies over it produce a 413 error of type `entity.too.large`.

_02_ How do I increase the limit?

Pass a larger `limit` to the parser, for example `express.json({ limit: '5mb' })`, ideally only on the route that needs it. The docs recommend using the default whenever possible.

_03_ Why do file uploads still fail after I raised the limit?

Multipart uploads are parsed by multer, which has separate `limits`. A proxy in front of Express can also enforce a smaller limit and return its own 413.

## Keep learning

[All errors](/errors)

[Learn 413 Request Entity Too Large HTTP status codes](/errors/http/413) [Related 4xx errors Status codes and links](/seo-issues/4xx-errors) [Read next 413 Request Entity Too Large in Apache HTTP status codes](/errors/http/413/apache) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 413 errors
[413 Request Entity Too Large in IIS](/errors/http/413/iis) [413 Request Entity Too Large in nginx](/errors/http/413/nginx) [Vercel 413: FUNCTION_PAYLOAD_TOO_LARGE](/errors/cdn/vercel-payload-too-large) [413 Payload Too Large in PHP uploads](/errors/http/413/php) [413 Payload Too Large on Cloudflare](/errors/http/413/cloudflare)

More in 413 Request Entity Too Large
[413 Payload Too Large in Express](/errors/http/413/express) [413 Payload Too Large in PHP uploads](/errors/http/413/php) [413 Payload Too Large on Cloudflare](/errors/http/413/cloudflare) [413 Request Entity Too Large in Apache](/errors/http/413/apache) [413 Request Entity Too Large in IIS](/errors/http/413/iis) [413 Request Entity Too Large in nginx](/errors/http/413/nginx)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
