# Content-Length (HTTP header)

> The HTTP Content-Length header gives the size of the message body in bytes. See when to send it, when not to, what a 411 means, and how to check yours.

Canonical: https://scaplet.com/glossary/content-length

Glossary Glossary · HTTP

The HTTP Content-Length header gives the size of the message body in bytes. See when to send it, when not to, what a 411 means, and how to check yours.

3 min

read

3

sources

Oct 21, 2026

updated

Scaplet Editorial Team

author

In one line

The HTTP Content-Length header indicates the size, in bytes, of the message body sent to the recipient. MDN says the message size must be known up front, before the headers are sent, which is a problem for dynamically generated or streamed content. HTTP/1.1 can use Transfer-Encoding: chunked instead, and in HTTP/2 the header is redundant.

30-second check

## Is this costing your site traffic?

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%2Fglossary%2Fcontent-length%20(%22Content-Length%20(HTTP%20header)%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%2Fglossary%2Fcontent-length%20(%22Content-Length%20(HTTP%20header)%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%2Fglossary%2Fcontent-length%20(%22Content-Length%20(HTTP%20header)%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%2Fglossary%2Fcontent-length%20(%22Content-Length%20(HTTP%20header)%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 6 parts, 3 minutes.

1. [What the header does 01](#what-the-header-does)
2. [When to send it and when not to 02](#when-to-send-it-and-when-not-to)
3. [Chunked, HTTP/2 and compression 03](#chunked-http-2-and-compression)
4. [Errors tied to it 04](#errors-tied-to-it)
5. [Check it in 2 minutes 05](#check-it-in-2-minutes)
6. [Not the same as article length 06](#not-the-same-as-article-length)

_01_Explained

## What the header does

`Content-Length` tells the receiver how many bytes of message body to expect. RFC 9110 defines it as the representation's data length as a decimal non-negative integer number of octets, for example `Content-Length: 3495`. It lets recipients delimit the message, measure transfer progress, know when a received message is complete, and potentially reuse the connection for more requests.

It appears in requests (POST bodies) and responses. The same RFC says a client normally sends it on a POST request even when the value is 0, indicating empty content.

_02_At a glance

## When to send it and when not to

Situation

### Request with content, no `Transfer-Encoding`

Rule (RFC 9110, section 8.6)

A [user agent](/glossary/user-agent) SHOULD send `Content-Length` when the method defines a meaning for enclosed content

Situation

### Response where the size is known before the headers go out

Rule (RFC 9110, section 8.6)

An origin server SHOULD send it (absent `Transfer-Encoding`)

Situation

### Response with a 1xx or 204 status

Rule (RFC 9110, section 8.6)

A server MUST NOT send it

Situation

### Response to HEAD or a 304

Rule (RFC 9110, section 8.6)

May be sent, but only if the value equals what a GET would have returned (HEAD) or a 200 would have carried (304)

Situation

### Forwarding a message with a value known to be incorrect

Rule (RFC 9110, section 8.6)

A sender MUST NOT forward it

The last row exists for security. The RFC warns that a value inconsistent with the received message framing might cause a security failure due to request smuggling or response splitting.

_03_Worth knowing

## Chunked, HTTP/2 and compression

### Streamed or generated responses

In HTTP/1.1, `Transfer-Encoding: chunked` can replace `Content-Length` for responses sent in parts as their size is calculated, per MDN.

### HTTP/2

MDN says `Content-Length` is redundant because the length can be inferred from DATA frames, though it may still be included for backwards compatibility. See [HTTP/2](/glossary/http-2).

### Wrong values

RFC 9110 says a sender must not forward a message with a value known to be incorrect. If something in your stack rewrites the body, such as compression, the value has to describe the body that is actually sent. See [gzip compression](/glossary/gzip-compression).

_04_Explained

## Errors tied to it

RFC 9110 defines the **411 Length Required** status: the server refuses to accept the request without a defined `Content-Length`. The client may repeat the request if it adds a valid header containing the length of the request content. See [411 Length Required](/errors/http/411). For uploads the server rejects as too big, see [413 Content Too Large](/errors/http/413). Both belong to the wider family of [HTTP status codes](/glossary/http-status-codes).

_05_Check it

## Check it in 2 minutes

On a static, uncompressed file the two numbers should match. If they differ, something between you and the origin changed the body, or the server computed the length differently for HEAD. If `Content-Length` is missing and `Transfer-Encoding: chunked` is present, the response is sent in parts.

Read the length your server sends

```
curl -sI https://example.com/ | grep -i -E 'content-length|transfer-encoding|content-encoding' curl -s https://example.com/ | wc -c
```

_06_Explained

## Not the same as article length

People also search "content length" meaning [word count](/glossary/word-count). Google's helpful content guidance asks whether you're writing to a particular word count because you've heard that Google has a preferred word count, and answers: no, it doesn't. Length should follow what the reader needs.

Questions

## Asked a lot.

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

_01_ What is Content-Length in HTTP?

A header that indicates the size, in bytes, of the message body sent to the recipient. RFC 9110 defines it as a decimal non-negative integer number of octets.

_02_ Is Content-Length required?

In HTTP/1.0 it is required, per MDN. In HTTP/1.1 it can be replaced with Transfer-Encoding: chunked for responses sent in parts, and in HTTP/2 it is redundant.

_03_ What does a 411 Length Required error mean?

The server refuses to accept the request without a defined Content-Length. Add a valid header with the length of the request content and retry.

_04_ Is there a maximum Content-Length?

RFC 9110 says there is no predefined limit to the length of content, so a recipient must anticipate potentially large numbers. Servers can still set their own limits and answer 413.

_05_ Does Google have a preferred content length for articles?

No. Google's guidance says it does not have a preferred word count.

Sources · 3

## Every fact, linked and dated.

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

- mozilla.org
- rfc-editor.org
- google.com

1. 01 [Content-Length header (MDN Web Docs)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Length) developer.mozilla.org · checked 2026-10-25
2. 02 [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110) rfc-editor.org · checked 2026-10-25
3. 03 [Creating helpful, reliable, people-first content (Google Search Central)](https://developers.google.com/search/docs/fundamentals/creating-helpful-content) developers.google.com · checked 2026-10-25

## Keep learning

[All glossary](/glossary)

[Learn Gzip compression Performance](/glossary/gzip-compression) [Related HTTP status codes Crawling and indexing](/glossary/http-status-codes) [Read next Cache-Control Performance](/glossary/cache-control) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[Content gap](/glossary/content-gap) [Content hub](/glossary/content-hub) [Content Management System](/glossary/content-management-system) [Content marketing](/glossary/content-marketing)

More in Performance
[Time to Interactive (TTI)](/glossary/time-to-interactive) [Total Blocking Time (TBT)](/glossary/total-blocking-time) [TTL (time to live)](/glossary/ttl) [Viewport meta tag](/glossary/viewport-meta-tag) [WebP](/glossary/webp) [AVIF](/glossary/avif) [bfcache (back/forward cache)](/glossary/bfcache) [Brotli compression](/glossary/brotli-compression) [Cache-Control](/glossary/cache-control) [CDN](/glossary/cdn) [Chrome UX Report (CrUX)](/glossary/chrome-ux-report) [Content Security Policy](/glossary/content-security-policy) [Content-Length (HTTP header)](/glossary/content-length) [Core Web Vitals](/glossary/core-web-vitals) [Core Web Vitals report](/glossary/core-web-vitals-report) [CORS](/glossary/cors) [Critical CSS](/glossary/critical-css) [Critical rendering path](/glossary/critical-rendering-path) [Cumulative Layout Shift (CLS)](/glossary/cumulative-layout-shift) [dns-prefetch](/glossary/dns-prefetch) [Edge caching](/glossary/edge-caching) [fetchpriority](/glossary/fetchpriority) [First Contentful Paint](/glossary/first-contentful-paint) [First Input Delay (FID)](/glossary/first-input-delay)

Terms on this page
[User agent](/glossary/user-agent) [HTTP/2](/glossary/http-2) [Gzip compression](/glossary/gzip-compression) [HTTP status codes](/glossary/http-status-codes) [Word count](/glossary/word-count)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

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

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
