Hydration failed because the server rendered HTML didn't match the client
Next.js "Hydration failed" error? The server and browser drew different HTML. Fix nesting, window/localStorage use and dates.
Reviewed October 14, 2026
What it means in plain English
Next.js draws your page on the server first, then React takes over in the browser. If the browser's version differs, React complains.
Likely causes
- Invalid HTML nesting, e.g.
<div>inside<p>,<a>inside<a>. - Using
window,localStorageortypeof windowchecks while rendering. - Showing
new Date()/random values during render. - Browser extensions changing the page.
How to fix it, step by step
- Read the error; Next.js shows the mismatching element.
- Fix bad nesting (change the outer
<p>to a<div>). - Move browser-only code into
useEffectso it runs after first render. - For components that truly can't render on the server, load them with
dynamic(() => import('./X'), { ssr: false }). - Test in an incognito window to rule out extensions.
How to check it worked
- Reload; the console shows no hydration warning.
Sources
Related fixes
Can't fix it? Get help.
If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.