We study the effects of vectorlike leptons on the W-boson mass in a model with a vectorlike U(1)' gauge symmetry. This model provides simultaneous explanations for the recent anomalies in the muon anomalous magnetic moment and the semileptonic decays of B mesons. We find that the recent result of the W-boson mass's precise measurement at CDF can be explained if the charged (neutral) vectorlike lepton is lighter than 250 (80) GeV. The light vectorlike leptons may not be excluded by collider experiments if these decay to a physical mode of the U(1)'-breaking scalar field.