dnd 5e – How deep is the Underdark? What is its maximum and median depth?

At least 26 miles deep, with rumors of unexplored caverns 40 miles deep, though most of the Underdark is 10 miles above the surface.

According to the D & D 3e manual Underdark, p.120, the lowest level of Underdark starts at a depth of ten miles and continues down from there:

No place in Toril is as strange and dangerous as the Lowerdark. This level of the Underdark extends from 10 miles below the surface at unfathomable depths and it presents a degree of strangeness that would drive some inhabitants of the surface crazy.

At this depth, it is described that tunnels and passages become rarer. Since this is the Underdark background, the typical depth of the Underdark locations is between 1 and 10 miles below the surface. For example, the city of Menzoberranzan is only 2 miles below the surface and is considered part of Upperdark.

Deeper locations

It is said that the portals to the plane of the Shadow (what in 5e would be called Shadowfell) exist at depths of 15 miles or less, which means that the Underdark is at least 15 miles deep. And 20 miles below the surface are detailed on page 123:

The Glimmersea is located 20 miles below the floor of the Sea of ​​the Fallen Stars.

Even more profound is the Genasi city of Earth's End (p.147), although it can not be reached without teleportation and does not have direct tunnels:

Located almost 22 miles Below Nath, in Halruaa, Earth's End is designed without apology for its extra-planar visitors.

Oryndoll, City of Loretakers, is just over 26 miles deep (p.168).

There is also a chasm below Anauroch, called Lorosfyr, the maddening darkness, it is rumored to be at least 40 miles deep in some places (p.160), although it is unexplored.