NextjsRoute Groups

Route Groups

Normally, every folder under app/ becomes a segment in the URL. A route group lets you break that rule on purpose: wrap a folder name in parentheses, like (marketing), and Next.js organizes routes inside it without adding marketing to the resulting path at all.

Folder structure

Text
app/
  (marketing)/
    layout.tsx
    page.tsx          // route: /
    about/
      page.tsx        // route: /about
  (shop)/
    layout.tsx
    cart/
      page.tsx        // route: /cart
    checkout/
      page.tsx        // route: /checkout
Note
The parenthesized folder name is completely excluded from the URL. In the structure above, (marketing)/about/page.tsx is served at /about — not /marketing/about. Only the parentheses trigger this behavior; a plain folder name always becomes a real URL segment.
Why organize routes this way
The main use case is giving unrelated sections of your app their own layout, without forcing every route in that section to live under a shared URL prefix. In the example above, (marketing) and (shop) each define their own layout.tsx — maybe the marketing pages get a simple header/footer, while the shop pages get a persistent cart sidebar — yet both sets of routes are mounted directly at the site root (/, /about, /cart, /checkout) rather than under /marketing/* or /shop/*.

Folder path

Resulting URL

app/(marketing)/page.tsx

/

app/(marketing)/about/page.tsx

/about

app/(shop)/cart/page.tsx

/cart

app/(shop)/checkout/page.tsx

/checkout

Other common uses
  • Opting a subset of routes into (or out of) a shared root layout, by moving them into their own group with a different layout.

  • Splitting a large app into logical sections for organization purposes only, with no intent to change the URL structure.

  • Creating multiple root layouts entirely — each top-level route group can define its own root layout.tsx (each must include its own <html> and <body> tags in that case).

You can have multiple route groups active at any given path segment, and their names have no effect on route matching or precedence beyond organizing which layout(s) wrap a given page.