Valproic acid is a medication primarily used to treat epilepsy and bipolar disorder and to prevent migraine headaches. It functions as an anticonvulsant and mood-stabilizing drug. It is also known by its brand names such as Depakote, Depakene, and Stavzor.