# HTTP 204 No Content — Status Code Meaning & Examples

> The request succeeded and there is intentionally no response body.

204 means success with nothing to say. It's the natural response to a DELETE, a PUT whose result the client doesn't need echoed back, or a fire-and-forget endpoint like an analytics beacon.

A 204 must not include a body. Bytes after the headers are a protocol error, and some proxies will read them as the start of the next response.

- Class: 2xx Success
- Retry: Not applicable
- Cacheable by default: yes
- Defined in: [RFC 9110 §15.3.5 — 204 No Content](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.3.5)

## Example response

```http
HTTP/1.1 204 No Content
```

## When you'll see it

- A DELETE succeeded.
- A PUT or PATCH saved and the client already has the new state.
- CORS preflight (OPTIONS) responses commonly use 204.

## How to use it well

1. Don't send a body: `res.status(204).json({})` is a bug.
2. Clients calling `response.json()` on a 204 will throw — check the status first.
3. If the client needs the updated object, return 200 with it instead.

## Send a 204 from your server

### Express

```
res.status(204).end();
```

### Next.js route handler

```
return new Response(null, { status: 204 });
```

### Flask

```
return "", 204
```

### Go net/http

```
w.WriteHeader(http.StatusNoContent)
```

### nginx

```
return 204;
```

## FAQ

### Why does response.json() fail on my 204?

There is no body to parse. Check response.status === 204 before calling .json().

### 204 or 200 for DELETE?

Either is valid. 204 when there's nothing to return; 200 if you return something useful, such as the deleted item.

## Related status codes

- [200 OK](https://www.devkult.com/http/200.md)
- [201 Created](https://www.devkult.com/http/201.md)
- [304 Not Modified](https://www.devkult.com/http/304.md)

Open the interactive page: https://www.devkult.com/http/204