Xanax is used to treat anxiety, panic disorders, and anxiety caused by alcohol withdrawal. It belongs to a class of medications called benzodiazepines which act on the brain and nerves (central nervous system) to produce a calming effect. It works by enhancing the effects of a certain natural chemical in the body (GABA).