Text content does not match server-rendered HTML

React ErrorSSR ErrorCommonLast updated: June 28, 2026Tested on:React v19.0Next.js 16June 2026

The text output on the client differed from what the server compiled.

Text content does not match server-rendered HTML Quick Fix⏱️ Est. Fix Time: 3–10 minutes

Usually happens because:

  • Rendering Date objects directly
  • Rendering Math.random() values
  • Dynamic browser localized text translations

🔍 Quick Checklist:

📊 Where this usually happens (estimated occurrence)

Dynamic Date/Time rendering60%
Math.random() outputs25%
Client locale language shifts15%

What is Text content does not match server-rendered HTML?

A subclass of hydration warnings, this occurs when text characters (rather than HTML element tags) differ between the server build and client rendering (such as rendering current timestamps or localized messages that change dynamically).

Common Causes

  • Rendering new Date() directly inside component text blocks.
  • Displaying random numbers (Math.random()) or client-specific sizes.
  • Varying texts dynamically using client geolocation settings.

Common Mistakes

  • Printing localized currencies or times directly on server outputs without locking the timezone locale configurations.

How to Fix

1Format dates and random calculations inside client-mounted useEffect states.
2Add suppressHydrationWarning to specific text tags.
3Use static mock text structures during server renders.

Framework-Specific Examples

No framework examples required for this informational status.

Wrong: Dynamic Date Render

HTTP Request
export default function Clock() {
  return <div>{new Date().toLocaleTimeString()}</div>;
}

Correct: Mounted Client State Date

HTTP Response
import { useState, useEffect } from 'react';

export default function Clock() {
  const [time, setTime] = useState('');
  
  useEffect(() => {
    setTime(new Date().toLocaleTimeString());
  }, []);

  return <div>{time}</div>;
}

Best Practices

  • Isolate dynamic state updates inside client hooks.

Frequently Asked Questions (FAQ)

Q: Does this warning crash the application?

No. In development, it prints a console warning. In production, React attempts to patch the text mismatch but it indicates poor render efficiency.

Q: How do I suppress hydration warnings?

Add `suppressHydrationWarning` to the specific JSX tag. It only goes one level deep.

Q: Why does the browser console show a long HTML diff?

React prints the exact diff between server static output and client output to help you locate the text mismatch.

Q: Can CSS changes cause text matches to fail?

No. Only text content and HTML nodes structure changes trigger this warning.

Still having this problem?

Didn't solve your problem?

SuggestRequest Error