Cannabidiol (CBD), a major non-psychoactive phytocannabinoid in cannabis, is an effective treatment for some forms of epilepsy and pain. At high concentrations, CBD interacts with a huge variety of proteins, but which targets are most relevant for clinical actions is still unclear. Here we show that CBD interacts with Nav1.7 channels at sub-micromolar concentrations in a state-dependent manner. Electrophysiological experiments show that CBD binds to the inactivated state of Nav1.7 channels with a dissociation constant of about 50 nM. The cryo-EM structure of CBD bound to Nav1.7 channels reveals two distinct binding sites. One is in the IV-I fenestration near the upper pore. The other binding site is directly next to the inactivated “wedged” position of the Ile/Phe/Met (IFM) motif on the short linker between repeats III and IV, which mediates fast inactivation. Consistent with producing a direct stabilization of the inactivated state, mutating residues in this binding site greatly reduced state-dependent binding of CBD. The identification of this binding site may enable design of compounds with improved properties compared to CBD itself.