perf hacks

Next.js Performance Hacks

Master Core Web Vitals and build blazing-fast Next.js apps

Next.js Performance Hacks

A performance optimization guide by make-it.run

slowfast

Next.js 14+ with App Router

This guide covers the App Router. Most concepts apply to Pages Router too.

TL;DR

Focus on Core Web Vitals: LCP (loading), INP (interactivity), CLS (stability). Start with image optimization and font loading for quick wins. Use static generation by default, ISR for dynamic content. Measure in production with real user data.

Welcome to the definitive guide for optimizing Next.js application performance. This documentation covers everything from Core Web Vitals to advanced rendering strategies.

What's Inside

This guide is organized into focused sections, each tackling a specific aspect of performance optimization:

Why Performance Matters

Performance isn't just about speed—it directly impacts:

Impact AreaEffect of Poor Performance
User ExperienceHigher bounce rates, lower engagement
SEO RankingsCore Web Vitals are ranking signals
Conversion RatesEach 100ms delay costs ~1% conversions
AccessibilitySlow sites hurt users on limited devices

In a 2006 study, Amazon found that every 100ms of latency cost them 1% in sales. Google's Marissa Mayer discovered that a 0.5 second delay caused a 20% drop in search traffic. These findings have been consistently validated in more recent studies.

Quick Start: Performance Audit

Run a quick performance check on your Next.js app:

# Install Lighthouse CLI
npm install -g lighthouse

# Run audit
lighthouse https://your-site.com --view

Check your Core Web Vitals in production:

// Add to your app
import { onLCP, onINP, onCLS } from 'web-vitals';

onLCP(console.log);
onINP(console.log);
onCLS(console.log);

Key Optimizations at a Glance

Rendering Strategy

// Static Generation - Best TTFB
export async function getStaticProps() {
  return { props: { data } };
}

// ISR - Fresh content, good performance
export async function getStaticProps() {
  return {
    props: { data },
    revalidate: 60
  };
}

// Streaming - Progressive loading
export default function Page() {
  return (
    <Suspense fallback={<Skeleton />}>
      <SlowComponent />
    </Suspense>
  );
}

Image Optimization

import Image from 'next/image';

// Optimized image with priority for LCP
<Image
  src="/hero.jpg"
  alt="Hero"
  width={1200}
  height={600}
  priority
/>

Code Splitting

import dynamic from 'next/dynamic';

// Load heavy components only when needed
const HeavyChart = dynamic(() => import('./Chart'), {
  loading: () => <ChartSkeleton />,
  ssr: false
});

Core Web Vitals Targets

MetricTargetWhat It Measures
LCP< 2.5sLoading performance
INP< 200msInteractivity
CLS< 0.1Visual stability

Learning Path

Understand Core Web Vitals Start with the Core Web Vitals overview to understand what metrics matter and why.

Measure Your Baseline Use the measuring guide to establish your current performance baseline.

Optimize LCP First LCP has the biggest perceived impact. Follow the LCP optimization guide.

Fix Layout Shifts CLS is often the easiest win. Check the CLS guide for quick fixes.

Improve Interactivity Make your app feel snappy with INP optimizations.

Advanced Techniques Dive into rendering strategies, bundle optimization, and caching for maximum performance.

Who This Is For

This guide is designed for:

  • Frontend developers building production Next.js apps
  • Tech leads establishing performance standards
  • DevOps engineers setting up performance monitoring
  • Anyone who wants their Next.js app to be fast

The Playbook

SectionWhat You'll Learn
Core Web VitalsLCP, INP, CLS in deep detail
RenderingSSG, SSR, ISR, and streaming strategies
Bundle OptimizationCode splitting and tree shaking
CachingCDN, route, and data cache layers
Images & MediaImage, font, and video optimization
RuntimeReact and JavaScript performance
Edge & NetworkEdge functions and middleware

Realistic Expectations

With focused effort, most teams see significant improvements:

OptimizationTypical Impact
Image optimization30-50% LCP improvement
Font optimization0.1-0.2 CLS reduction
Code splitting20-40% smaller bundles
Caching strategies50-80% faster TTFB
React optimization30-50% better INP

Under time pressure? Start with Core Web Vitals Overview for quick wins.

Want to understand the system? Read through the LCP, INP, and CLS guides in order.

Know your problem already? Jump directly to the relevant metric guide based on your PageSpeed Insights results.

Setting up monitoring? Start with Measuring & Monitoring to track your improvements.

Performance and cost optimization go hand-in-hand. Faster pages often cost less to serve. Next.js Cost Hacks covers Vercel pricing, function optimization, and bandwidth reduction strategies.


Built by make-it.run — Perfectly engineered apps for startups

Book a call →

Information current as of January 2026. Performance best practices evolve—verify specifics with the latest Next.js documentation.

On this page