Medical detox is most commonly done in an inpatient setting but can also be done on an outpatient basis as well. During detox, the patient either stops using the substance or substances to which they're addicted or gradually reduces their dose under medical supervision. This results in their body experiencing withdrawal, a painful, uncomfortable, and often terrifying series of symptoms ranging from cravings to hallucinations.