Xanax is a benzodiazepine. It's a medication that helps calm and relax you so that you can sleep, which is important if you have insomnia or need to sleep after surgery. It’s also used to treat panic attacks, post-traumatic stress disorder (PTSD), depression and chronic pain. If you have any of the following conditions: anxiety disorder with symptoms such as panic attacks; anxiety or panic disorders without any physical symptoms; alcohol withdrawal syndrome; schizophrenia; liver disease (elevated bilirubin levels).