Terbinafine is an antifungal medication primarily used to treat fungal infections of the skin and nails. It belongs to the allylamine class of antifungals and works by inhibiting the enzyme squalene epoxidase, which is crucial for the synthesis of ergosterol, a key component of fungal cell membranes.