The 304 Not Modified status code tells the client that the requested resource has not changed since the last request. Instead of sending the full response again, the server instructs the browser to use its cached version.
ETag and If-Modified-SinceWhen a browser requests a resource, it may include cache validation headers. If the server determines that the resource is unchanged, it responds with 304 Not Modified.
// Example of an HTTP response with 304 status
HTTP/1.1 304 Not Modified
Date: Tue, 03 Jan 2026 10:30:00 GMT
ETag: "abc123"
// Browser request using cache validation headers
GET /style.css HTTP/1.1
Host: example.com
If-None-Match: "abc123"
Since the ETag sent by the browser matches the server version, the server replies with 304 Not Modified. The browser loads the file from its cache instead of downloading it again.
Use the simulator below to understand how ETag validation results in a 200 or 304 response.
// JavaScript fetch request that may result in 304
fetch("/data.json")
.then(res => {
if (res.status === 304) {
console.log("Not modified, using cache.");
} else {
console.log("Downloaded new content.");
}
});
ETag or Last-Modified consistently