Bottom Line: It is 100% safe to delete .next/cache or the entire .next build folder. Next.js will regenerate the build cache automatically the next time you run npm run dev or npm run build.
What is the Next.js .next/cache Folder?
Located inside Next.js web application projects at .next/cache (specifically under .next/cache/fetch-cache, images, and swc), this directory is created by the Next.js framework.
Next.js uses this folder to cache:
- SWC / Babel Compiler Output: Fast compilation caches for TypeScript and React JSX code.
- Image Optimization Cache: Optimized WebP/AVIF images generated by
next/image. - Fetch Data Cache: Server-side
fetch()request caches in the App Router.
Over active web development, .next/cache accumulates stale build artifacts taking up 1 GB to 5 GB+ per project.
Can You Delete .next/cache?
✅ Yes, it is completely safe to delete.
- Zero source code lost: Your
app/,pages/,components/, andpublic/directories remain 100% safe. - Fixes stale dev bugs: Deleting
.next/cacheis the standard fix when Next.js dev server shows stale page data or fails to pick up code edits.
How to Safely Clean Up Next.js Cache
Method 1: Delete via Terminal Command
Navigate to your Next.js project directory and run:
# macOS / Linux
rm -rf .next/cache
# Windows (Command Prompt)
rmdir /s /q .next\cache
# Windows (PowerShell)
Remove-Item -Recurse -Force .next/cache
Related Guides
- Learn about deleting node_modules folders.
- How to clean up Vite cache.
- Check if you can clean Turborepo cache.
Discussion
Loading authentication...