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, localStorage or typeof window checks while rendering.
  • Showing new Date()/random values during render.
  • Browser extensions changing the page.

How to fix it, step by step

  1. Read the error; Next.js shows the mismatching element.
  2. Fix bad nesting (change the outer <p> to a <div>).
  3. Move browser-only code into useEffect so it runs after first render.
  4. For components that truly can't render on the server, load them with dynamic(() => import('./X'), { ssr: false }).
  5. Test in an incognito window to rule out extensions.

How to check it worked

  • Reload; the console shows no hydration warning.

Sources

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.

Request a fix