Xanax is a prescription medication primarily used to treat anxiety disorders, panic attacks, and generalized anxiety disorder (GAD). It belongs to a class of drugs called benzodiazepines, which work by enhancing the effects of a neurotransmitter in the brain called gamma-aminobutyric acid (GABA). By increasing GABA activity, Xanax helps calm the brain and nervous system, leading to a reduction in anxiety, panic symptoms, and agitation.