---
title: Performance Optimization for Web
description: Core web vitals, image optimization, and rendering strategies.
tags: [performance, optimization, core-web-vitals, lighthouse, loading]
---
# Performance Optimization for Web
## Core Web Vitals
| Metric | Target | Weight |
|--------|--------|--------|
| LCP | < 2.5s | 25% |
| CLS | < 0.1 | 15% |
| INP | < 200ms | 50% |
| FID (legacy) | < 100ms | 10% |
## Image Optimization
### Format Priority
1. WebP (best balance)
2. AVIF (best compression)
3. PNG (lossless)
4. JPEG (legacy)
### Sizing
```html
```
### Responsive Images
```html
```
## Critical CSS
```css
/* Inline above-the-fold styles */
/* Load rest async */
```
## Anti-Patterns
- Never use images > 500KB
- Never skip width/height attributes (causes CLS)
- Never block rendering with JavaScript
- Never forget to optimize fonts (subset, preload, display=swap)