To generate a static Next.js site, set output: 'export' in your Next.js configuration and run next build. Next.js writes the generated files to out by default; deploy those files to a static host. First check that your app does not depend on server-only features that a static export cannot provide.
1. Check whether static export fits your app
A static export works when the pages and assets your site needs can be produced during the build and served as files. It does not run a Next.js server after deployment to handle requests. The Next.js Static Exports guide lists these unsupported cases for the documented export path:
As an Amazon Associate I earn from qualifying purchases.
- Internationalized routing
- API Routes, rewrites, redirects, headers, and Proxy
- Incremental Static Regeneration (ISR) and Draft Mode
getServerSidePropsgetStaticPathswithfallback: trueorfallback: 'blocking'- The default
next/imageoptimization loader
For App Router Route Handlers, there is a narrower supported case: only GET handlers work in export mode when the route segment sets dynamic = 'force-static'. The build can emit static data files this way, but the result is not a general-purpose runtime API server. See the Next.js Backend for Frontend guide.
If the app needs request-time behavior or another excluded feature, use a deployment with a Next.js runtime instead. The deployment overview describes static export support as limited and Node.js server deployment as supporting all Next.js features.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
2. Enable export in the Next.js config
Add output: 'export' to the project configuration. Use the syntax matching your config file. The Pages Router example uses CommonJS in next.config.js; the App Router SPA guide also shows an ES module TypeScript config in next.config.ts.
CommonJS: next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
}
module.exports = nextConfig
TypeScript: next.config.ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
output: 'export',
}
export default nextConfig
These are alternative config styles; use the one appropriate to the config file your project already has. The setting and build behavior are documented in the Static Exports guide.
Rank #2
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
3. Choose URL and output-directory settings
Next.js emits route files whose paths need to agree with the URLs your host serves. Set these optional config values only when they match your routing and hosting setup:
Recommended Free Tools
| Setting | Effect |
|---|---|
trailingSlash: true |
Changes a route such as /me to /me/ and emits /me/index.html instead of /me.html. |
skipTrailingSlashRedirect: true |
Prevents Next.js from automatically redirecting /me to /me/ and preserves the requested href behavior. |
distDir: 'dist' |
Changes the export directory name from the default out to dist. |
For example, add a slash preference alongside the export setting:
Rank #3
const nextConfig = {
output: 'export',
trailingSlash: true,
}
Choose the URL shape your static host can resolve. The Next.js guide’s Nginx example uses try_files and a rewrite for the trailingSlash: false case; it notes that the special blog rewrite can be omitted with trailingSlash: true. See the Static Exports guide for the server configuration example.
4. Build the static files
Run the production build from the project directory:
Rank #4
next build
With export enabled, Next.js generates route HTML and static assets in out, unless you changed the directory with distDir. The documentation’s example output includes index.html, 404.html, and HTML for concrete dynamic-route values such as /blog/post-1.html. Check the generated directory after building and confirm that the routes you expect to publish have corresponding files.
5. Make image delivery work without the default optimizer
The default next/image optimization loader is unsupported with static export. If you keep using next/image, configure a custom loader with images.loader: 'custom' and images.loaderFile; the official example constructs image URLs for Cloudinary. Alternatively, optimize images separately and serve the resulting files.
Best Value
- JavaScript Jquery
- Introduces core programming concepts in JavaScript and jQuery
- Uses clear descriptions, inspiring examples, and easy-to-follow diagrams
A custom or remote image service may optimize images at runtime rather than during the static build. That means page export alone does not make the image service’s work build-time. The options and example are in the Static Exports guide and self-hosting guidance.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.6. Deploy the export directory and check route resolution
Publish the contents of the export directory—not a running Next.js server—to a static file host. The generated HTML, CSS, JavaScript, and other assets can be served by a web server capable of delivering static files; the official guide names AWS S3, Nginx, and Apache as examples.
- Build the app with
next build. - Upload the contents of
out, or your configured export directory, to the static host. - Configure the host to resolve URLs to the emitted files using the same slash and filename behavior you selected in Next.js.
- Verify a nested route, its assets, and a missing route such as a deliberate 404. If clean URLs do not map correctly, adjust the host’s file resolution or your slash setting.
The key requirement is file serving, not a particular provider: “Since Next.js supports this static export, it can be deployed and hosted on any web server that can serve HTML/CSS/JS static assets.” — Next.js documentation, “Guides: Static Exports”, last updated March 25, 2026.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Static export is not necessarily a single-page app
A Next.js static export can generate HTML for each route rather than one client-rendered shell. That can provide route-specific HTML and automatic code splitting; separate route files can also avoid loading unnecessary JavaScript. Client-side navigation can still provide SPA-like transitions. The distinction matters when choosing a host and rendering strategy: export describes how the app is built and deployed, not a requirement that every route share one HTML entry point. See the Static Exports guide and SPA guide.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




