Xanax is a prescription medication used to treat anxiety and panic disorders. It's a type of benzodiazepine, which works by calming the brain and nerves. Like other benzodiazepines, Xanax has a risk of dependency and withdrawal symptoms if used long-term.