Using a sample of gamma-ray burst (GRB) afterglows detected by both the X-Ray Telescope (XRT) and the UV/Optical Telescope (UVOT) on Swift, we modelled the spectral energy distributions (SEDs) to determine gas column densities and dust extinction in the GRB local environment. In six out of seven cases we ﬁnd an X-ray absorber associated with the GRBhostgalaxywithcolumndensity(assumingsolarabundances)rangingfrom(0.8–7.7) × 1021 cm−2.Wedeterminetherest-framevisualextinctionAV usingtheSmallMagellanicCloud (SMC), Large Magellanic Cloud (LMC) and Galactic extinction curves to model the dust in theGRBhostgalaxy,andthisrangesfrom AV = 0.12 ± 0.04to0.65+0.08 −0.07.TheafterglowSEDs weretypicallybestﬁtbyamodelwithanSMCextinctioncurve.InonlyonecasewastheGRB afterglow better modelled by a Galactic extinction curve, which has a prominent absorption feature at 2175Å. We investigate the selection effects present in our sample and how these might distort the true distribution of AV in GRB host galaxies. We estimate that GRBs with no afterglow detected blueward of 5500Å have average rest-frame visual extinctions almost eight times those observed in the optically bright population of GRBs. This may help account for the ∼1/3 of GRBs observed by Swift that have no afterglow detected by UVOT.