What are Core Web Vitals?
Core Web Vitals are Google's metrics for user experience on websites. They measure three aspects: loading speed, interactivity, and visual stability. Since 2021, they've been an official ranking factor – poor scores can affect your position in search results.
The Three Metrics in Detail
LCP – Largest Contentful Paint
What it measures: How quickly does the largest visible element (usually an image or text block) load?
Target: Under 2.5 seconds
Typical problems:
- Slow server response times
- Render-blocking resources (CSS, JavaScript)
- Large, uncompressed images
- Missing prioritization of important resources
INP – Interaction to Next Paint
What it measures: How quickly does the page respond to user interactions (clicks, taps, keyboard input)?
Target: Under 200 milliseconds
Typical problems:
- Long JavaScript execution times
- Too much JavaScript on the main thread
- Event handlers that block the thread
- Third-party scripts affecting interactivity
CLS – Cumulative Layout Shift
What it measures: How much do elements shift during loading?
Target: Under 0.1
Typical problems:
- Images without defined dimensions
- Dynamically inserted content (ads, embeds)
- Web fonts causing layout shifts
- Content inserted above the viewport
Practical Optimizations
1. Loading Images Correctly
The biggest potential often lies with images. Use modern formats and optimized loading strategies:
// Next.js Image Component
import Image from 'next/image';
<Image
src="/hero.jpg"
width={1200}
height={600}
priority // For above-the-fold images
placeholder="blur" // Prevents CLS
/>Image Checklist:
- WebP or AVIF instead of JPEG/PNG
- Responsive srcset for different screen sizes
- Lazy loading for images below the viewport
- Always specify width and height (prevents CLS)
- priority attribute for hero images
2. Optimizing JavaScript
JavaScript is often the biggest performance killer. Reduce bundle size and defer non-critical scripts:
// Dynamic import for code-splitting
const HeavyComponent = dynamic(
() => import('./HeavyComponent'),
{ ssr: false, loading: () => <Skeleton /> }
);
// Defer third-party scripts
<Script
src="https://analytics.example.com"
strategy="lazyOnload"
/>JavaScript Checklist:
- Analyze your bundle with webpack-bundle-analyzer
- Code-splitting: Only load what's needed
- Tree shaking: Remove unused code
- Defer third-party scripts (analytics, chat widgets)
- Avoid long tasks on the main thread (> 50ms)
3. Optimizing Fonts
Web fonts often cause layout shifts and block rendering:
/* Font-display for faster rendering */
@font-face {
font-family: 'Custom Font';
src: url('/fonts/custom.woff2') format('woff2');
font-display: swap; /* or optional */
}Font Checklist:
- Use only WOFF2
- font-display: swap or optional
- Preload fonts for critical text
- Define system fonts as fallback
- Minimize number of font variants
4. Improving Server Response Time
A slow server negates all other optimizations:
Server Checklist:
- Use CDN for static assets
- Set caching headers correctly
- Optimize database queries
- Edge functions for dynamic content
- Enable compression (Brotli > Gzip)
Measurement Tools
Lighthouse (Chrome DevTools)
Quick analysis of individual pages. Shows specific improvement suggestions.
PageSpeed Insights
Combines lab data (Lighthouse) with real user data (Chrome UX Report).
Web Vitals Extension
Browser extension that shows Core Web Vitals in real-time.
Search Console
Shows how Google rates your Core Web Vitals across the entire site. Important for prioritization.
Prioritization: Where to Start?
1. Measure first: Use Search Console for an overview
2. Focus on the most important pages: Homepage, landing pages, product pages
3. Fix the biggest problems first: Usually it's images or JavaScript
4. Test on real devices: Lighthouse simulates mid-range devices, real users often have worse connections
Conclusion
Core Web Vitals aren't rocket science. Most problems can be solved with proven best practices: optimize images, reduce JavaScript, avoid layout shifts. The effort is worth it – not just for SEO, but for a better user experience.