The short answer is that herbs are usually more forgiving about shallow soil, while flowers often need a little more depth—but the ideal depth depends on the specific plants you choose. For a simple urban herb planter, a minimum depth of 6 to 8 inches (15 to 20 cm) works for shallow-rooted herbs such as basil, cilantro, thyme, oregano, and salad greens. If you want a more flexible mixed herb box, choose 10 to 12 inches (25 to 30 cm). Deeper-rooted herbs like rosemary, sage, parsley, and mint do better in 12 to 18 inches (30 to 45 cm), especially if you want them to stay healthy through hot weather.
Flowers generally benefit from more root space. Small annuals and bedding flowers can grow in about 8 to 10 inches (20 to 25 cm) of soil, but most healthy flower displays perform better with 12 inches (30 cm) or more. Perennials, bulb plantings, and taller flowers usually need 12 to 18 inches (30 to 45 cm), while deep-rooted perennials or small flowering shrubs may need 18 to 24 inches (45 to 60 cm). A good all-purpose urban planter box for a mix of herbs and flowers is therefore around 12 to 15 inches (30 to 38 cm) deep, with 15 to 18 inches (38 to 45 cm) being even more forgiving.
Depth is not the only issue. Drainage holes, good lightweight soil, enough width for root spread, and access to sunlight matter just as much in an urban setting. If the planter is on a balcony or rooftop, also consider the weight of wet soil. In practice, a 12-inch-deep planter is a safe starting point for many herbs and flowers, but choose 6 to 8 inches only for shallow herbs and compact annuals, and go deeper for thirsty, tall, or perennial plants.