The Pivka Basin or the Pivka Valley, also simply Pivka, is a varied basin in southwestern Slovenia, lying between high Dinaric plateaus, the Karst Plateau, and the Brkini Hills. It covers an area of 160 square kilometres (62 sq mi). To the northwest, it is bordered by Mt. Nanos, to the north, by Hrušica, to the east by the Javornik Hills and Mt. Snežnik, and to the west by the lower Slavina Plain and Tabor Hills. The lower part of the basin between Nanos and the Postojna Gate is known as the Lower Pivka Basin, and the upper part between Prestranek and Snežnik as the Upper Pivka Basin.
The Black Sea–Adriatic Sea drainage divide crosses the Pivka Basin, with the majority of water flowing to the Ljubljanica Basin. The Pivka River with its tributary the Nanoščica sinks in Postojna Cave. Part of the water flows to the Lokva River, which sinks below Predjama Castle, merges with the sinking rivers Belščica, Stranske Ponikve, and Šmihelske Ponikve, and flows into the sources of the Vipava River. The Rakuljšica and some smaller creeks, tributaries of the Reka River, run on the southern edge of the basin, below Sajevče.
In the Upper Pivka Basin, there is a vertical bifurcation, with the surface waters running to the Black Sea Basin, and the underground waters to the Adriatic Sea Basin. The bottom of the basin, which is sometimes considered a karst field, has an elevation of 500 to 600 m (1,600 to 2,000 ft). The lowest point of the basin (464 m or 1,522 ft) is at the Lokva ponor below Predjama Castle.