Can You Delete the .next Folder? Yes, and Here's Why

Yes, it's safe to deleteDiskmack safety tier: Safe to clean
**/.next

Yes, the .next folder is safe to delete. It holds compiled pages and build cache for one Next.js project, and Next.js rebuilds all of it the next time you run next dev or next build. The only cost is a slower first build while the cache warms back up.

What it is

.next is the build output directory Next.js creates inside every project. When you run next build, the compiler writes your compiled pages, server bundles, and static assets there. Both next dev and next build also keep an incremental compiler cache in .next/cache so the next compile can reuse work it already did.

The cache is the part that grows. Every route you touch, every dependency that gets bundled, and every image the optimizer processes leaves something behind. Small sites stay modest, but a large app with a long-lived cache often reaches several hundred megabytes, and heavy projects can pass a gigabyte. Multiply that by every Next.js project on your Mac and the total adds up quietly.

Is it safe to delete?

Deleting .next loses nothing you can't get back. Your source code, components, config, and content all live outside it. The folder is pure output: remove it and the next next build or next dev run recreates everything from source. The first build afterward is slower because the incremental cache is gone, typically seconds to a few minutes depending on the project.

Two small caveats. Don't delete it while a dev server or production server is running from that folder; stop the process first. And if you serve a production build with next start, the app reads from .next, so run next build again before restarting. Diskmack finds every .next folder across your projects automatically and clears them the safe way.

How to check its size

In Finder: In Finder, choose Go > Go to Folder (Cmd+Shift+G) and enter your project path, for example ~/Projects/my-app. Press Cmd+Shift+. (period) to show hidden files, click the .next folder once to select it, then press Cmd+I to see its size.

In Terminal:

du -sh ~/Projects/my-app/.next

Replace ~/Projects/my-app with your project's actual path; the ~ expands to your home folder. If the path contains spaces, quote everything after the ~/, like du -sh ~/"My Projects/my app/.next".

How to clean it

  1. Stop any running Next.js process for the project: press Ctrl+C in the terminal window running next dev or next start.
  2. Open the project folder in Finder. If you don't see .next, press Cmd+Shift+. (period) to show hidden files.
  3. Drag the .next folder to the Trash.
  4. Empty the Trash to actually free the space.
  5. Next time you work on the project, run next dev or next build as usual. The folder comes back on its own.

Each Next.js project has its own .next folder. If you have several projects, repeat this in each one, and check old abandoned projects first since their caches are pure dead weight.

Will it come back?

Yes, immediately and by design. The moment you run next dev or next build, Next.js recreates .next and starts filling the cache again. That's fine. The cache exists to make rebuilds fast, and it earns its disk space in projects you actively work on. The folders worth deleting are in projects you haven't touched in months, where the cache holds space and does nothing.

Common questions

Will deleting .next break my Next.js project?

No. All of your source code lives outside .next. The folder is generated output, and the next build or dev run recreates it completely. The one exception is a production server mid-run: next start reads from .next, so stop it first and run next build before starting it again.

Why is my .next folder so large?

Almost always .next/cache. Next.js keeps an incremental compiler cache there so rebuilds can reuse earlier work. It grows with every route, dependency, and optimized image, and it doesn't trim itself aggressively. Deleting the folder resets it.

Can I delete just .next/cache instead?

Yes. That keeps the last production build usable for next start while still reclaiming most of the space, since the cache is usually the bulk of the folder. The trade is the same either way: your next build starts cold.

Should .next be in .gitignore?

Yes, and create-next-app adds it by default. Build output doesn't belong in version control. Every machine that clones the repo generates its own copy.

Related folders