---
title: "SSG vs SSR: Differences and How to Choose"
url: https://encited.com/blog/ssg-vs-ssr
description: "SSG vs SSR compared: build-time vs request-time HTML, TTFB, server cost, caching, ISR, Next.js patterns, SEO and AI crawlers, and how to pick per page."
lang: en
---

Image: SSG vs SSR: Differences, Pros and Cons, and How to Choose (2026) (https://encited.com/blog/thumbnails/ssg-vs-ssr.webp)

# SSG vs SSR: Differences, Pros and Cons, and How to Choose (2026)

Nov 27, 2026 November 27, 2026 · by Aki from Encited

SSG vs SSR compared: build-time vs request-time HTML, TTFB, server cost, caching, ISR, Next.js patterns, SEO and AI crawlers, and how to pick per page.

SSG vs SSR is a choice about when a page's HTML gets built. Static site generation (SSG) builds every page once, at deploy time, and serves the same files from a CDN to everyone. Server-side rendering (SSR) builds each page on the server when a request comes in, so the HTML can reflect data from that moment and that visitor.

Both send browsers and crawlers a finished page, so both are good for SEO. The difference is in freshness, speed, cost and how many pages you can build. Content that changes on deploy fits SSG. Content that changes by the minute, or by the person asking, fits SSR. Incremental static regeneration (ISR) sits between them, and most frameworks let you choose per route.

**TL;DR**

- **SSG** builds HTML at deploy time. Fastest time to first byte, lowest cost and nothing to break at request time, but pages are only as fresh as the last build.
- **SSR** builds HTML per request. Always current and can be personalized, but every uncached request costs server time.
- **ISR** serves static pages and rebuilds them in the background on a timer or on demand.
- **For SEO**, both put content in the first response. SSG pages can go stale, and SSR pages can be slow or fail under load.
- **Pick per page**: SSG for docs, blog posts and landing pages, SSR for search results, accounts and fast-changing prices, ISR for large catalogs.

## What is static site generation (SSG)?

SSG stands for static site generation. During the build, the framework runs your page code once per URL, fetches the data, and writes each page out as an HTML file. The deployed site is a folder of files that a CDN serves as is.

In the browser, the page still loads JavaScript and hydrates, so interactive parts work. Data that has to be current, like stock or a cart count, can be fetched on the client after the page loads.

Next.js, Astro, Gatsby, Hugo, Eleventy, Jekyll, Docusaurus, Nuxt with `nuxi generate` and SvelteKit with `prerender` all generate static pages.

**Advantages of SSG**

- **Fastest response.** The CDN returns a cached file from the location nearest the visitor.
- **Lowest running cost.** No server code runs per request, so traffic spikes cost almost nothing.
- **Nothing to fail at request time.** A database outage doesn't take the pages down.
- **Easy to secure.** There's no application server exposed to the internet.

**Disadvantages of SSG**

- **Content is only as fresh as the last build.** A price change or a new article waits for a rebuild.
- **Build time grows with page count.** Tens of thousands of product pages can turn a build into a long job.
- **No per-request personalization** in the HTML. Anything that depends on the visitor loads on the client.

## What is server-side rendering (SSR)?

With SSR, the server runs your page code for each request, fetches the data, and returns HTML built at that moment. It can read cookies, headers and query parameters, so the page can depend on who is asking and what they searched for.

Next.js dynamic routes, Nuxt, SvelteKit, Remix and React Router in framework mode, Angular with `@angular/ssr`, and server stacks like PHP, Rails and Django all render per request.

**Advantages of SSR**

- **Always current.** Prices, stock and listings are correct at the moment of the request.
- **Personalization in the HTML.** Location, language, logged-in state and search queries can shape the page.
- **No build-time ceiling.** A million URLs cost nothing until someone requests them.

**Disadvantages of SSR**

- **Higher time to first byte.** The server has to run code and often query a database before responding.
- **Compute on every uncached request**, including crawler traffic.
- **More ways to fail.** A slow API or an overloaded server makes pages slow or returns errors, and crawlers see those errors too.

## SSG vs SSR comparison

| | Static site generation (SSG) | Server-side rendering (SSR) |
| --- | --- | --- |
| When HTML is built | At deploy time | On each request |
| Time to first byte | Lowest, served from a CDN | Higher, the server builds the page first |
| Server cost | Static hosting | Servers or functions per uncached request |
| Caching | Every page cached by default | Possible with cache headers, but personalized pages can't be shared |
| Data freshness | As of the last build | As of the request |
| Personalization in HTML | No | Yes |
| Build time | Grows with page count | Short, pages render on demand |
| Failure at request time | Rare, files are already built | Slow data or errors reach visitors and crawlers |
| SEO | Full HTML in the first response | Full HTML in the first response |
| AI crawlers | Read the full page | Read the full page |
| Typical pages | Docs, blogs, marketing, help centers | Search results, accounts, dashboards with public views, live pricing |

## Performance: TTFB, caching and Core Web Vitals

**Time to first byte** is where SSG wins most clearly. A static file from a CDN edge is about as fast as the web gets. SSR adds the time to run your code and fetch data, and that time varies with load.

**Largest contentful paint (LCP)** is usually good for both, because both send content in the HTML. SSG has the edge when SSR responses are slow, since LCP can't start before the HTML arrives.

**Caching SSR** narrows the gap. If a page is the same for everyone, the server can send `Cache-Control: s-maxage=60, stale-while-revalidate=300` and let the CDN serve it for a minute at a time. Personalized pages can't be shared in a cache, so they pay the full cost on every request.

**Interaction to next paint (INP)** depends on JavaScript, and both approaches hydrate the same way. A static page with a heavy bundle still responds slowly to the first click.

## Hydration: what happens after the HTML arrives

Both SSG and SSR send HTML that looks finished but isn't interactive yet. The browser then downloads the JavaScript, React or Vue rebuilds the component tree in memory, matches it to the existing markup, and attaches event handlers. That step is hydration.

If the HTML from the build or the server differs from what the client renders, you get a hydration mismatch: a warning in development, and sometimes a flash of changed content in production. Dates, random IDs and anything read from `window` are the usual causes. Islands architectures like Astro, and React Server Components, reduce hydration cost by shipping JavaScript only for the parts that need it.

## ISR and on-demand revalidation

Incremental static regeneration keeps SSG's speed and fixes most of its freshness problem. Pages are served from the static cache. After a set time, or when your code asks for it, the framework rebuilds the page in the background and swaps in the new version.

In the Next.js App Router, a time-based rebuild is one export:

tsx

Copy Download

// app/products/[slug]/page.tsx

export const revalidate = 3600; // rebuild at most once an hour

export async function generateStaticParams () {

const products = await getTopProducts (1000);

return products. map ((p) => ({ slug: p. slug }));

}

export default async function Page ({ params }: { params: Promise < { slug: string } > }) {

const { slug } = await params;

const product = await getProduct (slug);

return < h1 > { product. name } </ h1 >;

}

`generateStaticParams` builds the top 1,000 products at deploy time. Other product URLs render on first request and are then cached like the rest. When a product changes, a webhook can call `revalidatePath("/products/" + slug)` or `revalidateTag("products")` to rebuild right away.

ISR fits large catalogs and content sites where most pages change rarely and a few change often. The trade-off: the first visitor after an expiry gets the old page while the new one builds.

To check that a rebuilt page reached crawlers, fetch it with the Googlebot simulator (https://encited.com/free-tools/crawler-simulator/googlebot-simulator) and look for the new price or text in the raw HTML.

## SSG vs SSR in Next.js

**Pages Router.** `getStaticProps` makes a page static, `getStaticPaths` lists which dynamic URLs to build, and adding `revalidate` to `getStaticProps` turns on ISR. `getServerSideProps` makes a page render on every request.

**App Router.** Routes are static by default and become dynamic when they read request data such as `cookies()`, `headers()` or `searchParams`. You can force the choice with `export const dynamic = "force-static"` or `"force-dynamic"`. Since Next.js 15, `fetch` results aren't cached by default; pass `cache: "force-cache"` or `next: { revalidate: 60 }` to cache them. Running `next build` prints each route with a marker showing whether it's static or dynamic.

## Other frameworks

- **Astro** builds static pages by default. Setting `export const prerender = false` on a page, with a server adapter installed, renders it on request.
- **Nuxt** renders on the server by default. `nuxi generate` produces a static site, and `routeRules` can mark routes as `prerender`, cached with `swr`, or client-only.
- **SvelteKit** renders on the server unless a route sets `export const prerender = true`.
- **Gatsby** is static first and also supports deferred static generation and SSR per page.
- **Remix and React Router** render on the server, and React Router in framework mode can prerender listed routes at build time.

## SSG vs SSR for SEO

Both give crawlers complete HTML in the first response, which is what matters most. Googlebot doesn't need its rendering pass, and AI crawlers like GPTBot and ClaudeBot, which don't run JavaScript, read the full page. Neither one ranks better by itself.

The SEO risks are different:

- **Stale SSG pages.** A sold-out product still showing in stock, or an old price in your structured data, is what crawlers index until the next build. Rebuild on change, or use ISR.
- **Slow or failing SSR pages.** Crawlers hit your server like visitors do. Timeouts and 5xx errors under load can cut how often Google crawls, and a 500 served to a crawler can drop a page from the index.
- **Client-loaded content on either.** Reviews, related products or prices fetched in the browser after hydration aren't in the HTML of an SSG or an SSR page. Crawlers that read only the first response miss them.
- **Sitemaps and `lastmod`.** On SSG sites, regenerate the sitemap with each build so new pages are discovered. On SSR sites, make sure `lastmod` reflects real content changes.

For what each approach gives a crawler, and where pre-rendering fills the gaps, see SSR vs SSG vs pre-rendering (https://encited.com/blog/ssr-vs-pre-rendering).

## How to choose

Ask these questions for each type of page:

1. **Does the HTML depend on who is asking?** Logged-in state, location, language detected per request: SSR.
2. **How often does the content change?** Only on deploy: SSG. Every few hours: ISR. Every few seconds, or it must be exact: SSR.
3. **How many pages are there?** Hundreds: SSG. Tens of thousands: ISR with the top pages built ahead and the rest on demand. Unbounded, like search result pages: SSR.
4. **What happens if the data source is down?** If the page should stay up anyway, SSG or ISR serves the last good version.
5. **What does traffic look like?** Large spikes are cheap on static files and costly on uncached SSR.

## Mixing SSG, SSR and ISR in one app

Most sites end up with all three:

- **Marketing pages, docs and blog**: SSG.
- **Product and category pages**: ISR, with webhooks to rebuild changed products.
- **Search results, cart and account**: SSR or client-side rendering.

Next.js, Nuxt, SvelteKit and Astro all set this per route, so one codebase can serve each page the cheapest way that keeps it correct.

Sites that can't move to any of these, like client-side apps and sites built with AI website builders, can still give crawlers full HTML with pre-rendering. A rule in front of the site serves crawlers a snapshot rendered in a real browser, and dynamic rendering for SEO (https://encited.com/blog/dynamic-rendering-seo) covers when that's the right call. To find out whether your pages already reach Google, check them in Index Rush (https://encited.com/get-indexed-faster), which shows which URLs are indexed, discovered or missing.

Encited (https://encited.com/dynamic-rendering) does this with a DNS change or a middleware rule, on client-side apps and server-rendered sites alike, and also captures content that loads after hydration. Plans start at $19 a month, with a 14-day free trial.

## FAQ

**What does SSG stand for?** Static site generation: building every page to an HTML file at deploy time and serving those files from a CDN.

**What is the difference between SSG and SSR?** SSG builds pages once at deploy time and serves the same file to everyone. SSR builds each page on the server when it's requested, so it can use current data and request details.

**What is CSR vs SSR vs SSG vs ISR?** CSR builds the page in the browser. SSR builds it on the server per request. SSG builds it at deploy time. ISR serves static pages and rebuilds them in the background on a schedule or on demand. SSR vs CSR (https://encited.com/blog/ssr-vs-csr) covers the first two in detail.

**What is SSR used for?** Pages whose HTML has to be current or depends on the request: search results, live prices and stock, personalized pages and anything behind a login that still renders on the server.

**Is SSG better than SSR?** For pages that change only on deploy, yes: faster, cheaper and harder to break. For pages that need fresh or personalized data, or too many URLs to build ahead of time, SSR or ISR fits better.

**Is SSR or CSR better?** For public pages that need search traffic, SSR, because crawlers get the content in the first response. For logged-in apps, CSR is simpler and cheaper. More in SSR vs CSR (https://encited.com/blog/ssr-vs-csr).

**Is SSG better for SEO than SSR?** Neither ranks better by itself, since both send full HTML. SSG pages are faster and never fail under load, and SSR pages are never stale. Pick based on how fresh the content needs to be.

**Can you mix SSR, SSG and ISR in the same application?** Yes. Next.js, Nuxt, SvelteKit and Astro let you choose per route, so static pages, regenerated pages and per-request pages can live in one app.

**How does hydration work with SSG and SSR?** The browser shows the HTML first, then downloads the JavaScript, and the framework attaches event handlers to the existing markup so the page becomes interactive. It works the same way for static and server-rendered pages.

Image: Google (https://encited.com/crawler-logos/google-search.svg)

Image: Gemini (https://encited.com/crawler-logos/gemini.png)

Image: ChatGPT (https://encited.com/crawler-logos/chatgpt.svg)

Image: Claude (https://encited.com/crawler-logos/claude.svg)

Image: Grok (https://encited.com/crawler-logos/xai.svg)

Image: Meta (https://encited.com/crawler-logos/meta.svg)

Image: Perplexity (https://encited.com/crawler-logos/perplexity.svg)

## Get discovered anywhere search happens

Readable, citable, outranking pages.

Talk to sales: https://encited.com/contact-sales

Image: Avatar (https://replymaven.com/api/uploads/Su6Q0nK63iZW0ZFJBRNWpmRuppVDLuab/98df5262-f992-45fa-a750-00a6c919baf9.png)

How can we help?

Get instant answers to your questions or leave a message for an engineer will reach out

Ask AI about Encited

See our docs (https://lovablehtml.com/docs)

Contact support

Leave a message

We'll get back to you soon

Ask AI about Encited

Product questions, troubleshooting and

Thinking

Image: Preview

Drop an image to attach

Powered by ReplyMaven (https://replymaven.com/)

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Home",
        "item": "https://encited.com/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "Blog",
        "item": "https://encited.com/blog"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "SSG vs SSR: Differences, Pros and Cons, and How to Choose (2026)",
        "item": "https://encited.com/blog/ssg-vs-ssr"
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "SSG vs SSR: Differences, Pros and Cons, and How to Choose (2026)",
    "description": "SSG vs SSR compared: build-time vs request-time HTML, TTFB, server cost, caching, ISR, Next.js patterns, SEO and AI crawlers, and how to pick per page.",
    "image": "https://encited.com/blog/thumbnails/ssg-vs-ssr.webp",
    "datePublished": "2026-11-27",
    "dateModified": "2026-11-27",
    "author": {
      "@type": "Person",
      "name": "Aki from Encited"
    },
    "publisher": {
      "@type": "Organization",
      "name": "Encited.com",
      "alternateName": "LovableHTML.com",
      "logo": {
        "@type": "ImageObject",
        "url": "https://encited.com/brand/logo.svg"
      }
    },
    "mainEntityOfPage": {
      "@type": "WebPage",
      "@id": "https://encited.com/blog/ssg-vs-ssr"
    }
  }
]
```