Idrija (, in older sources Zgornja Idrija; (Ober)idria, Idria) is a town in western Slovenia. It is the seat of the Municipality of Idrija. It is located in the traditional region of Inner Carniola and is in the Gorizia Statistical Region. It is notable for its mercury mine with stores and infrastructure, as well as miners' living quarters, and a miners' theatre. Together with the Spanish mine at Almadén, it has been a UNESCO World Heritage Site since 2012. In 2011, Idrija was given the Alpine Town of the Year award.
The town of Idrija lies in the Idrija Basin, surrounded by the Idrija Hills. It is traversed by the Idrijca River, which is joined there by Nikova Creek. It includes the hamlets of Brusovše, Cegovnica, Prenjuta, and Žabja Vas close to the town center, as well as the more outlying hamlets of Češnjice, Ljubevč, Kovačev Rovt, Marof, Mokraška Vas, Podroteja, Razpotje, Staje, and Zahoda. The Marof hydroelectric plant is located on the Idrijca River on the northern outskirts of Idrija, between Marof and Mokraška Vas. Springs in the area include Podroteja Spring and Wild Lake on the Idrijca River south of the town.