Xanax (alprazolam) is used to treat anxiety disorders, panic disorders, and anxiety caused by depression. It works by slowing down the movement of chemicals in the brain that may become unbalanced. This results in a reduction in nervous tension (anxiety).