Xanax is primarily used for the short-term relief of symptoms associated with anxiety disorders, including feelings of tension, worry, and nervousness. It is also prescribed to alleviate symptoms of panic attacks, such as sudden episodes of intense fear or discomfort. Additionally, Xanax may be used as an adjunctive treatment for certain medical conditions, such as insomnia and depression, when anxiety is a contributing factor.