Skip to content

First Contentful Paint (FCP) Delay Fix

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about First Contentful Paint (FCP) Delay Fix. We cover key concepts, practical examples, and best practices.

The Problem

First Contentful Paint (FCP) marks the moment when the browser renders the first piece of content from the DOM. Delayed FCP means users stare at a blank screen — caused by render-blocking CSS/JS, slow server response, or missing critical rendering path optimization.

Quick Fix

Step 1: Eliminate render-blocking resources

<!-- Wrong — CSS blocks rendering -->
<link rel="stylesheet" href="styles.css">
<script src="app.js"></script>

<!-- Right — inline critical CSS, defer non-critical -->
<style>
    /* Critical above-the-fold styles */
    body { font-family: sans-serif; margin: 0; }
    .header { display: flex; padding: 1rem; }
    .hero { max-width: 1200px; margin: 0 auto; }
</style>

<link rel="preload" href="styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="styles.css"></noscript>

<script defer src="app.js"></script>

Step 2: Optimize server response time

// Wrong — slow TTFB delays FCP
// Server response takes 3 seconds

// Right — use CDN, caching, and server optimization
// 1. Use CDN (Cloudflare, CloudFront) for edge caching
// 2. Enable compression (Brotli or gzip)
// 3. Use HTTP/2 for multiplexing
// 4. Configure caching headers:

// Cache-Control: public, max-age=31536000, immutable
// For HTML:
// Cache-Control: no-cache // or use CDN page caching

Step 3: Minimize CSS and remove unused styles

# Wrong — sending all CSS, including unused
# styles.css is 250KB

# Right — purge unused CSS (with PurgeCSS)
npx purgecss --css styles.css --content index.html --output dist/
<!-- Before: 250KB -->
<link rel="stylesheet" href="styles.css">

<!-- After: 15KB -->
<link rel="stylesheet" href="styles-purged.min.css">

Step 4: Use font-display to prevent blank text

/* Wrong — font blocks rendering (FOIT) */
@font-face {
    font-family: 'Custom';
    src: url('/fonts/custom.woff2');
}

/* Right — use swap to show fallback immediately */
@font-face {
    font-family: 'Custom';
    src: url('/fonts/custom.woff2');
    font-display: swap;
}

/* Or use optional for performance */
@font-face {
    font-family: 'Custom';
    src: url('/fonts/custom.woff2');
    font-display: optional;
}

Step 5: Preconnect to third-party origins

<!-- Wrong — DNS lookup delays third-party resources -->
<script src="https://api.example.com/sdk.js"></script>

<!-- Right — preconnect to critical origins -->
<link rel="preconnect" href="https://api.example.com">

<!-- or use dns-prefetch as fallback -->
<link rel="dns-prefetch" href="https://api.example.com">

Prevention

  • Inline critical CSS and defer the rest with loadCSS pattern
  • Set cache headers and use a CDN for fast TTFB
  • Purge unused CSS rules
  • Use font-display: swap or optional for all custom fonts
  • Preconnect to third-party origins that host critical resources

Common Mistakes with fcp delay

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world PERF code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is a good FCP score?

Lighthouse classifies FCP as: Good (under 1.8s), Needs Improvement (1.8-3.0s), Poor (over 3.0s). Aim for under 1.8 seconds on both mobile and desktop.

How is FCP different from LCP?

FCP is the first visible content — any pixel of text or image. LCP is the largest visible element. FCP always happens before or at the same time as LCP. Optimizing FCP improves perceived performance, while LCP measures loading completeness.

Does FCP affect SEO?

FCP is not a direct ranking factor but is part of the Page Experience signals. Google uses FCP in Lighthouse scoring and it impacts user engagement metrics like bounce rate and time on page.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro