Opioid-based anesthesia is a traditional form of anesthesia that has a significant analgesic effect; however, it can cause nausea, vomiting, delirium, and other side effects. Opioid-free anesthesia with dexmedetomidine and lidocaine has attracted widespread attention. This study aimed to compare the effects of opioid-free and opioid-based anesthesia (OFA and OBA, respectively) on postoperative recovery in patients who had undergone video-assisted thoracic surgery. Eighty patients undergoing video-assisted thoracic surgery were assigned to receive either opioid-free anesthesia (OFA group) or opioid-based anesthesia (OBA group) according to random grouping. The primary outcome of the study was the quality of recovery-40 scores (QoR-40) 24 h postoperatively. The secondary outcome measure was numerical rating scale (NRS) scores at different times 48 h postoperatively. In addition to these measurements, other related parameters were recorded. Patients who received opioid-free anesthesia had higher QoR-40 scores (169.1 ± 5.1 vs. 166.8 ± 4.4, p = 0.034), and the differences were mainly reflected in their comfort and emotional state; however, the difference between the two groups was less than the minimal clinically important difference of 6.3. We also found that the NRS scores were lower in the OFA group than in the OBA group at 0.5 h (both p < 0.05) and 1 h (both p < 0.05) postoperatively and the cumulative 0-24 h postoperative dosage of sufentanil in the OBA group was higher than that in the OFA group (p = 0.030). There were no significant differences in postoperative nausea and vomiting (PONV) (p = 0.159). No surgical or block complications were observed between the groups. Opioid-free analgesia potentially increased the postoperative recovery in patients who underwent video-assisted thoracic surgery. The study protocol was registered in the Chinese Clinical Trial Register under the number ChiCTR2100045344 (http://www.chictr.org.cn/showproj.aspx?proj=125033) on April 13, 2021.