Alprazolam, commonly sold under the brand name Xanax, is a medication primarily used to treat anxiety, panic disorders, and sometimes insomnia. It belongs to a class of medications called benzodiazepines, which act as central nervous system depressants.