A topical formulation for treating toenails and fingernails is provided. This formulation includes a mixture of calcium hydroxide, sodium hydroxide, an antifungal agent, and an applicating agent. The formulation is topically applied to a patient's fingernail or toenail to treat a fungal infection, to remove discoloration, and/or to thin an overly thick nail.