# Text content does not match server-rendered HTML

> A React or Next.js hydration mismatch. Find the changing render, bad HTML nesting or CDN rewrite behind it and fix it with useEffect or ssr false.

Canonical: https://scaplet.com/errors/browser/text-content-does-not-match-server-rendered-html

Guide Error · Browser errors

A React or Next.js hydration mismatch. Find the changing render, bad HTML nesting or CDN rewrite behind it and fix it with useEffect or ssr false.

3 min

read

5

sources

Oct 31, 2026

updated

Scaplet Editorial Team

author

In one line

"Text content does not match server-rendered HTML" is React error 425, a hydration mismatch: the first client render produced different output than the HTML the server sent. Common causes are `Date.now()` or `Math.random()` in render, `typeof window` branches, invalid tag nesting, browser extensions, and CDNs that rewrite HTML. Make the first render deterministic, or move the difference into `useEffect`.

30-second check

## Where does your site stand?

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%2Ferrors%2Fbrowser%2Ftext-content-does-not-match-server-rendered-html%20(%22Text%20content%20does%20not%20match%20server-rendered%20HTML%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%2Ferrors%2Fbrowser%2Ftext-content-does-not-match-server-rendered-html%20(%22Text%20content%20does%20not%20match%20server-rendered%20HTML%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%2Ferrors%2Fbrowser%2Ftext-content-does-not-match-server-rendered-html%20(%22Text%20content%20does%20not%20match%20server-rendered%20HTML%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%2Ferrors%2Fbrowser%2Ftext-content-does-not-match-server-rendered-html%20(%22Text%20content%20does%20not%20match%20server-rendered%20HTML%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 4 parts, 3 minutes.

1. [What the error is saying 01](#what-the-error-is-saying)
2. [Find the mismatch 02](#find-the-mismatch)
3. [Fixes, from the Next.js and React docs 03](#fixes-from-the-next-js-and-react-docs)
4. [What it means for search and crawlers 04](#what-it-means-for-search-and-crawlers)

_01_Causes listed by React and Next.js, and the first thing to check

## What the error is saying

Next.js describes the cause as a difference between the React tree prerendered on the server and the tree rendered in the browser during the first render ([hydration](/glossary/hydration)). React's `hydrateRoot` docs are blunt: it "expects the rendered content to be identical with the server-rendered content. You should treat mismatches as bugs and fix them."

Cause

### Server/client branch in render

Typical code

`if (typeof window !== 'undefined')` inside JSX logic

Check

Search render paths for `window`, `document`, `localStorage`

Cause

### Changing values

Typical code

`Date.now()`, `new Date()`, `Math.random()` in render

Check

Compare the HTML source with the DOM after load

Cause

### Locale formatting

Typical code

`toLocaleString()` without a fixed locale and time zone, which differs between server and user

Check

Pass explicit locale and `timeZone`

Cause

### Invalid HTML nesting

Typical code

`<div>` or `<ul>` inside `<p>`, `<a>` inside `<a>`, `<button>` inside `<button>`

Check

Validate the [markup](/glossary/structured-data); fix the component tree

Cause

### External data without a snapshot

Typical code

Reading a store that differs on the client

Check

Send the data with the HTML and read the same value on first render

Cause

### Browser extension

Typical code

Extension edits HTML before React loads

Check

Reproduce in a private window with extensions off

Cause

### CDN or edge rewrite

Typical code

Cloudflare Auto Minify or similar changing the HTML response

Check

Compare `curl` output through the CDN and straight from origin

Cause

### iOS data detectors

Typical code

Phone numbers, dates, emails and addresses turned into links

Check

Add the `format-detection` meta tag shown below

React has a family of messages for this. Error 425 reads "Text content does not match server-rendered HTML." Error 418 reads "Hydration failed because the server rendered %s didn't match the client. As a result this tree will be regenerated on the client." The fix is the same idea for both.

_02_How it works

## Find the mismatch

Compare origin HTML with CDN HTML

```
# Replace the origin address with yours curl -s https://example.com/page > cdn.html curl -s -H "Host: example.com" https://ORIGIN_IP/page -k > origin.html diff cdn.html origin.html | head -n 40
```

1. 01

### Read the exact message

In development React and Next.js log which element or text differed. Note whether it names text, an attribute or a tag.
2. 02

### View source, not the DOM

Open View Page Source (the server HTML) and compare with the Elements panel (the hydrated DOM). The difference is your mismatch.
3. 03

### Rule out extensions and the CDN

Test in a private window with extensions disabled, then fetch the page from origin and through the CDN and diff the bodies.
4. 04

### Bisect the component

Comment out time, random and `window` usage until the error stops, then restore pieces one at a time.

_03_Fix it on your stack

## Fixes, from the Next.js and React docs

1. Render the difference after hydration with useEffect
1. Render the difference after hydration with useEffect

```
import { useState, useEffect } from 'react' export default function App() { const [isClient, setIsClient] = useState(false) useEffect(() => { setIsClient(true) }, []) return <h1>{isClient ? 'This is never prerendered' : 'Prerendered'}</h1> }
```

2. Turn SSR off for one component (Next.js)
2. Turn SSR off for one component (Next.js)

```
import dynamic from 'next/dynamic' const NoSSR = dynamic(() => import('../components/no-ssr'), { ssr: false }) export default function Page() { return ( <div> <NoSSR /> </div> ) }
```

3. Unavoidable difference such as a timestamp
3. Unavoidable difference such as a timestamp

```
<time dateTime="2016-10-25" suppressHydrationWarning />
```

iOS: stop automatic phone and email links
iOS: stop automatic phone and email links

```
<meta name="format-detection" content="telephone=no, date=no, email=no, address=no" />
```

**suppressHydrationWarning is an escape hatch**Both React and Next.js say it only works one level deep, is intended as an escape hatch and should not be overused. React will not attempt to patch mismatched text content when it is set, so the server text stays until something else updates it.

 Strengths
- `useEffect` keeps the server HTML stable and fixes the mismatch at the source
- `ssr: false` is quick for widgets that depend on browser APIs

 Weaknesses
- Content set in `useEffect` or under `ssr: false` is not in the server HTML, so crawlers that do not run JavaScript will not see it
- `suppressHydrationWarning` hides the warning without fixing text that differs

_04_Explained

## What it means for search and crawlers

Google's JavaScript SEO guide says server-side or [pre-rendering](/glossary/static-site-generation) "is still a great idea because it makes your website faster for users and crawlers, and not all bots can run JavaScript". A mismatch itself is a runtime bug, but the fixes above decide what ships in the server HTML. Keep important copy, links and metadata in the prerendered output, and use the client-only paths for widgets. See [JavaScript SEO](/glossary/javascript-seo) for what to verify.

Sources · 5

## Every fact, linked and dated.

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

- nextjs.org
- react.dev
- google.com

1. 01 [Next.js: Text content does not match server-rendered HTML](https://nextjs.org/docs/messages/react-hydration-error) nextjs.org · checked 2026-11-01
2. 02 [React: hydrateRoot](https://react.dev/reference/react-dom/client/hydrateRoot) react.dev · checked 2026-11-01
3. 03 [React error 425](https://react.dev/errors/425) react.dev · checked 2026-11-01
4. 04 [React error 418](https://react.dev/errors/418) react.dev · checked 2026-11-01
5. 05 [Google: Understand JavaScript SEO basics](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics) developers.google.com · checked 2026-11-01

Questions

## Asked a lot.

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

_01_ Is a hydration mismatch an error or a warning?

React says to treat mismatches as bugs. In development it warns, and error 418 states that the affected tree will be regenerated on the client.

_02_ Why does it only happen for some users?

Browser extensions that change the HTML before React loads are a documented cause, as are locale-dependent date formatting and iOS data detection.

_03_ Can a CDN cause it?

Yes. The Next.js docs list an incorrectly configured edge or CDN that modifies the HTML response, such as Cloudflare Auto Minify, as a cause.

_04_ Should I just add suppressHydrationWarning?

Only for a single element that must differ, like a timestamp. It works one level deep and React will not patch mismatched text content.

## Keep learning

[All errors](/errors)

[Learn Uncaught ReferenceError: x is not defined Browser errors](/errors/browser/uncaught-referenceerror-is-not-defined) [Related JavaScript SEO Crawling and indexing](/glossary/javascript-seo) [Read next Uncaught TypeError: Cannot read properties of undefined Browser errors](/errors/browser/uncaught-typeerror-cannot-read-properties-of-undefined) [Do Run a free site audit Free, about two minutes](/site-audit)

More in Browser errors
[Access-Control-Allow-Origin](/errors/browser/access-control-allow-origin) [Aw, Snap!](/errors/browser/aw-snap) [blocked:mixed-content](/errors/browser/blocked-mixed-content) [Chrome out of memory](/errors/browser/chrome-out-of-memory) [Firefox Server Not Found](/errors/browser/firefox-server-not-found) [Firefox: "Secure Connection Failed"](/errors/browser/firefox-secure-connection-failed) [Firefox: File not found](/errors/browser/firefox-file-not-found) [Firefox: the connection has timed out](/errors/browser/firefox-the-connection-has-timed-out) [Firefox: Warning: Potential Security Risk Ahead](/errors/browser/firefox-warning-potential-security-risk-ahead) [Refused to apply style ... because its MIME type](/errors/browser/refused-to-apply-style-from-because-its-mime-type) [Safari can't find the server](/errors/browser/safari-can-t-find-the-server) [Safari can't open the page](/errors/browser/safari-can-t-open-the-page) [Safari: "This Connection Is Not Secure" and related warnings](/errors/browser/safari-this-connection-is-not-private) [SSL certificate problem: unable to get local issuer certificate](/errors/browser/ssl-certificate-problem-unable-to-get-local-issuer-certificate) [Text content does not match server-rendered HTML](/errors/browser/text-content-does-not-match-server-rendered-html) [This page isn't working](/errors/browser/this-page-isn-t-working) [This site can't provide a secure connection](/errors/browser/this-site-can-t-provide-a-secure-connection) [Uncaught ReferenceError: x is not defined](/errors/browser/uncaught-referenceerror-is-not-defined) [Uncaught TypeError: Cannot read properties of undefined](/errors/browser/uncaught-typeerror-cannot-read-properties-of-undefined) [Your connection is not private](/errors/browser/your-connection-is-not-private) [Your connection is not private in Chrome (on every site)](/errors/browser/your-connection-is-not-private-chrome)

Terms on this page
[Hydration](/glossary/hydration) [Structured data](/glossary/structured-data) [JavaScript SEO](/glossary/javascript-seo) [Static site generation](/glossary/static-site-generation)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

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

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
