We explore the impact of modified gravity on B-modes, identifying two main separate effects: lensing and propagation of tensor modes. The location of the inflationary peak of the BB spectrum depends on the speed of gravitational waves; the amplitude of the lensing contribution depends on the anisotropic stress. We single out these effects using the quasi-static regime and considering models for which the background and the growth of matter perturbations are standard. Using available data we obtain that the gravitational wave speed is compatible with the speed of light and constrained to within about 10%.