413 413 Payload Too Large
The request body exceeds the server's maximum allowed size.
What Is This?
The HTTP 413 Payload Too Large status code (formerly known as 413 Request Entity Too Large) indicates that the request body exceeds the server's maximum allowed size. Every server has limits on how large a request body it will accept. This limit protects the server from resource exhaustion attacks and accidental oversized uploads.
Common Causes & Solutions
Common Cause
File upload exceeding the server's maximum body size
Common Cause
JSON or form data payload larger than the configured limit
Common Cause
Base64-encoded data that expands significantly in size
Increase the upload limit
Configure your web server and application framework to allow larger request bodies.
# Nginx (increase to 50MB)
client_max_body_size 50M;
# Express.js
app.use(express.json({ limit: '50mb' }))
app.use(express.urlencoded({ limit: '50mb', extended: true }))
# Apache
LimitRequestBody 52428800
# Vercel/Next.js API route
// Vercel has a 4.5MB body limit for serverless functions
// For larger uploads, use client-side upload to blob storageImplement chunked uploads
For large files, implement chunked uploads that split the file into smaller pieces sent sequentially.
// Client-side chunked upload
const CHUNK_SIZE = 1024 * 1024 // 1MB
async function uploadChunked(file) {
for (let i = 0; i < file.size; i += CHUNK_SIZE) {
const chunk = file.slice(i, i + CHUNK_SIZE)
await fetch('/api/upload', {
method: 'POST',
headers: {
'Content-Range': `bytes ${i}-${i + chunk.size - 1}/${file.size}`,
'Content-Type': 'application/octet-stream'
},
body: chunk
})
}
}Related Entries
More from this reference:
400 400 Bad Request
The server cannot process the request due to client-side input errors.
401 401 Unauthorized
Authentication is required but was missing or invalid.
403 403 Forbidden
The client is authenticated but does not have permission to access the resource.
404 404 Not Found
The requested resource could not be found on the server.
405 405 Method Not Allowed
The HTTP method used is not allowed for this resource.
408 408 Request Timeout
The server timed out waiting for the client to send the complete request.
422 422 Unprocessable Entity
The request has valid syntax but contains semantic validation errors.
429 429 Too Many Requests
The client has exceeded the rate limit and should slow down.
Frequently Asked Questions
What is a reasonable maximum body size?
For most APIs, 1-10 MB is reasonable. For file upload APIs, 10-100 MB is common. For video or large media files, use chunked uploads or direct-to-cloud-storage uploads instead of increasing the limit significantly.
Does 413 apply to URL length too?
URL length limits are separate and typically return 414 URI Too Long. The 413 status specifically applies to the request body size, not the URL or headers.