HTTP 204 No Content

HTTP 204 No Content means the server successfully processed the request and is not returning any content. The response deliberately has no body. It is the correct response for actions that succeed but have nothing to return — DELETE operations, PUT updates where the client already has the updated state, and form submissions that do not require a page reload.

HTTP 204 full guide →

Quick reference

Code204
NameNo Content
Category2xx Success
SpecificationRFC 9110 §15.3.5
IANA statusAssigned
CacheableYes — cacheable by default
Client actionNo body to read. For browser navigation, do not reload the current page.
In-depth guideHTTP 204 full guide →

What HTTP 204 means

RFC 9110 defines 204 as indicating that the server has fulfilled the request and there is no additional content to send in the response body. A 204 response must not include a message body. The connection is kept alive for subsequent requests.

The key distinction from 200 OK is that 204 explicitly signals "success, nothing to return" rather than "success, here is the result." For browser-based applications, a 204 response to a form submission tells the browser not to navigate away from the current page — it stays where it is. This behavior makes 204 useful for in-page actions like saving a draft, toggling a preference, or liking a post.

204 is also the standard response for CORS preflight OPTIONS requests. The browser sends an OPTIONS request to check what cross-origin headers are allowed, receives a 204 with the allowed headers listed, then proceeds with the actual request if permitted.

Common use cases

DELETE requests

After a successful deletion, there is nothing to return about the deleted resource. 204 is the conventional response: the resource is gone, the operation succeeded, no body needed. Some APIs return 200 with a confirmation body, but 204 is more semantically correct and avoids parsing overhead.

PUT and PATCH updates

When a PUT or PATCH update succeeds and the client already has the updated representation (because it sent it), returning the full resource in a 200 body is redundant. 204 signals success without the wasted bytes. If the server modifies the resource during the update (adding timestamps, generating IDs), return 200 with the modified representation instead.

Preference and settings endpoints

Endpoints that toggle settings, update notification preferences, or record user actions with no meaningful return value suit 204 well. The client knows the action succeeded and has nothing to update in its local state.

CORS preflight

Browsers send an OPTIONS preflight request before cross-origin requests with custom headers or non-simple methods. The correct response is 204 with the appropriate CORS headers (Access-Control-Allow-Origin, Access-Control-Allow-Methods, etc.) and no body.

Common mistakes

Returning 204 with a body

RFC 9110 explicitly forbids a message body with 204. If a 204 includes a body, HTTP clients must ignore it. Some implementations return 204 with JSON in the body — the body is silently discarded by conforming clients, leading to confusing behavior where the response appears empty even though content was sent.

Returning 204 when the client needs updated state

If the server modifies the resource in ways the client cannot predict — adding server-generated fields, recalculating related values — return 200 with the updated representation instead. A 204 implies the client already has everything it needs.

Using 204 instead of 404 when the resource is missing

A DELETE to a non-existent resource should return 404 Not Found, not 204. Returning 204 for a missing resource implies success, which hides bugs in client code that assumes the deletion actually occurred.

204 vs related codes

CodeNameBodyUse when
200OKRequiredSuccess with a result to return
201CreatedOptionalNew resource created, Location header set
204No ContentForbiddenSuccess with nothing to return
205Reset ContentForbiddenSuccess, browser should reset the form/view

FAQ

What does HTTP 204 No Content mean?

HTTP 204 means the request succeeded and the server has nothing to return in the response body. It is used for successful DELETE requests, settings updates, and form submissions where no page navigation or data return is needed.

Can a 204 response have a body?

No. RFC 9110 forbids a message body with 204. Any body content sent with a 204 must be ignored by conforming HTTP clients.

When should I use 204 instead of 200?

Use 204 when the operation succeeded and there is nothing meaningful to return — the client does not need a body to proceed. Use 200 when the response includes a result the client needs to read.

What happens in the browser when a form returns 204?

A browser that receives 204 in response to a form submission stays on the current page without navigating. This makes 204 useful for in-place actions like saving a draft or toggling a preference without a page reload.

Related resources

On this site: HTTP 204 No Content — full guide · HTTP 200 OK · HTTP 201 Created · HTTP 205 Reset Content · All 2xx success codes

Standards: RFC 9110 §15.3.5 · IANA HTTP Status Code Registry · MDN Web Docs: 204