Skip to article
TOOLS. SYSTEMS. BETTER DECISIONS.
Stack & Method

The journal

Which HTTP status code represents no content?

A clear answer to the PAA: 204 No Content. Practical differences from 304 Not Modified, with examples and a quick validation checklist.

Full-bleed minimalist editorial panel with a highlighted primary-filled tile and adjacent neutral code block placeholders indicating a no-content HTTP status reference

204 No Content is the HTTP status code that represents no response body. It means the request succeeded and the server intentionally returns no message body. See MDN for the normative definition: MDN: 204 No Content.

What 204 No Content means, in practice

204 indicates success without a response body. It is commonly used when a server has performed the requested action and there is nothing further to send back. Typical patterns include:

  • DELETE: action completed, nothing else to return.
  • PUT: update succeeded but you do not need to return a representation; an ETag may be provided for the updated state.

MDN also notes two important protocol behaviors for 204:

  • The response must not include any content (no message body).
  • The response must not include the Content-Length header; browsers may reject responses that include content for 204 MDN: 204 No Content.

Additionally, 204 responses are cacheable by default, and servers can include an ETag when applicable MDN: 204 No Content.

Minimal close up conceptual diagram of an HTTP response header block shown as stacked bars with the top bar highlighted in blue and an empty body area indicating no content

How 204 differs from 304 Not Modified

304 Not Modified is not a generic "no body" success. It is a cache validation response that tells the client to use its cached representation when a conditional request indicates the resource has not changed. Key differences:

  • Purpose:
    • 204: confirms the server completed the action and has nothing to return.
    • 304: confirms the client’s cached copy is still valid for a conditional GET or HEAD, so the server does not retransmit the resource MDN: 304 Not Modified.
  • When it is used:
    • 204: any method where success requires no body (commonly DELETE or PUT) MDN: 204 No Content.
    • 304: conditional GET or HEAD requests with If-None-Match or If-Modified-Since, when the condition evaluates to false (resource not modified) MDN: 304 Not Modified.
  • Response body and headers:
    • Both 204 and 304 have no response body.
    • 304 should include the headers that would accompany the equivalent 200 OK, for example: Cache-Control, Content-Location, Date, ETag, Expires, and Vary MDN: 304 Not Modified.
    • 204 must not include a message body and should not include Content-Length MDN: 204 No Content.

Minimal 204 response example

HTTP/1.1 204 No Content
Date: Wed, 26 Jun 2024 12:00:00 GMT
Server: example

No message body follows. Do not send a Content-Length header for 204 MDN: 204 No Content.

Minimal 304 response example (conditional GET)

HTTP/1.1 304 Not Modified
Date: Wed, 28 Aug 2024 10:36:35 GMT
ETag: "b20a0973b226eeea30362acb81f9e0b3"
Cache-Control: public, max-age=3600
Vary: Accept-Encoding

The body is absent. The headers guide cache behavior and identify the validated representation MDN: 304 Not Modified.

Minimal 2D vector flowchart on soft blue background showing five unlabelled rounded nodes connected by arrows each node uses a simple icon representing success created accepted no content reset

Quick ways to test 204 and 304 behavior

  • Use your browser’s Network panel to inspect responses and confirm there is no body for 204, and that 304 is returned for conditional requests with ETag or Last-Modified as expected. If you need a walkthrough, see How to check HTTP response headers in Chrome.
  • For DELETE endpoints, verify the server returns 204 on success when no representation is needed; ensure your client code paths treat 204 distinctly from 200. For idempotency considerations, see Is HTTP DELETE idempotent?

Validate your API’s no-content responses

FAQ

Is 204 cacheable?

Yes. MDN notes that a 204 response is cacheable by default, and servers may include an ETag in such cases MDN: 204 No Content.

Should I send Content-Length: 0 with 204?

No. For 204, do not send a message body, and do not include the Content-Length header. Some browsers may reject responses that include content for 204 MDN: 204 No Content.

Can I return 304 for POST?

304 is defined for conditional GET or HEAD when If-None-Match or If-Modified-Since evaluates to false; it indicates the cached representation is still valid MDN: 304 Not Modified.

Stack & Method logo

Related guides

Sources and further reading

Your privacy choices

Optional analytics helps us improve these guides. It stays off until you allow it. Privacy details