Xanax can be tested via a urine test or blood test. Xanax can be detected in your body from 2 to 6 days after ingestion. In your urine, however, it can be detected up to 10 days and in your hair up to 90 days. The drug can also be found in your saliva and sweat.