# Declare UTF-8 character encoding > The charset (UTF-8) is declared correctly as the first element in the head. **Priority:** critical · **Difficulty:** beginner · **Time:** 5 min --- The UTF-8 character set must be declared early in the HTML head to ensure proper character rendering across all languages and symbols. ## Code Example ```html Your Page Title ``` ## Why It Matters - **International Support**: Enables proper display of all Unicode characters - **Security**: Prevents character encoding attacks - **Early Declaration**: Must be within first 1024 bytes of document - **Consistency**: Ensures same rendering across all browsers and platforms ## Framework Examples Front-End Checklist ``` Vite App
``` ```tsx // app/layout.tsx return ( {children} ) } ``` ``` // Next.js emits UTF-8 automatically in the document head. // Verify the rendered HTML rather than adding a duplicate meta charset tag. ```
Your app content
) } ``` ## Best Practices ✅ **Position Early**: Place as first meta tag ```html ``` ✅ **Use UTF-8**: Universal character support ```html ``` ❌ **Avoid Old Syntax**: Don't use verbose XHTML syntax ```html ``` ## Tools & Validation - [W3C Markup Validator](https://validator.w3.org/) - [HTML5 Validator](https://html5.validator.nu/) - Browser DevTools Network tab to check response headers ## Standards - Use MDN: HTML as the standard for the final rendered HTML and browser-facing behavior. - Use WHATWG HTML Living Standard as the standard for the final rendered HTML and browser-facing behavior. ## Verification ### Automated Checks - Inspect the final rendered HTML in the browser or page source to confirm the rule is satisfied. - Validate the affected markup with browser tooling or an HTML validator where appropriate. - Test one representative route or template that uses the pattern. - Re-check shared components that emit the same markup so the fix is consistent. ### Manual Checks - Verify the rendered browser behavior manually on representative routes and supported browsers so the user-facing outcome matches the rule.