Error library

Next.js hydration error: Text content does not match server-rendered HTML

The HTML rendered on the server differs from the first render in the browser, usually from window/localStorage, Date(), random values, or invalid HTML nesting. Make the first client render match the server and move browser-only values into useEffect.

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

Cause: Rendering logic produces different output on server and client (browser APIs, time, randomness, invalid nesting, extensions).

How to fix it

  1. Open the dev overlay to see which element differs.
  2. Move browser-only reads (window, localStorage) into useEffect or a client-only component.
  3. Fix invalid nesting such as <div> inside <p>.
  4. Use useId instead of random IDs; for unavoidable cases like timestamps use suppressHydrationWarning sparingly.

Example

Illustrative example, not from a customer project.

- <span>{new Date().toLocaleString()}</span>
+ const [time, setTime] = useState<string>()
+ useEffect(() => setTime(new Date().toLocaleString()), [])
+ <span>{time}</span>

FAQ

Could a browser extension cause it?

Yes. Next.js docs list extensions that modify HTML as a cause. Test in a clean profile.

Is `suppressHydrationWarning` a fix?

It is an escape hatch that works one level deep. Use it only for content that must differ, like timestamps.

QUICK FIX · $49 · THIS ERROR ONLY

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

One error, one root cause, fixed in your app. If it turns out bigger, we tell you before doing more, and your $49 is credited toward the fix, diagnosis or Launch Path if you book within 14 days. Fixing three? The 3-Error Pack is $119.

Bigger job: Getting the whole app live? Launch Path, $1,195 flat.

Built with Lovable, Bolt, Replit, Cursor or v0? See rescue by platform and the security checklist.

Check it yourself first, free

$49Fix this error