Ice-stream shear margins are the lateral boundaries of narrow, fast-flowing bands of ice within an ice sheet. We develop a theory for the migration of shear margins over time driven by viscous dissipation of heat within the ice, focusing on widening of the ice stream. The location of the margin is modelled as a transition from a cold to a temperate ice-sheet bed, and simultaneously as the transition from no slip to free slip at the same location. The temperature field in the ice is affected by intense shear heating as well as by the migration velocity of the margin (i.e. by the widening rate of the ice stream); if migration is too fast, there is little time for the ice to warm up and the margin remains cold, causing the bed to freeze. This suppresses widening. Conversely, if the migration speed is too slow, the ice in the margin warms up, causing the bed on the far side of the cold–temperate transition to reach the melting point, and migration to speed up. Using a Wiener–Hopf method, we show that for a given far-field shear stress, geothermal heat flux, and ice geometry, there is a single migration velocity that balances the two effects and permits widening at a steady rate. This velocity increases with the far-field lateral shear stress imposed by the ice stream, which controls shear heating in the margin. Our results also indicate that (i) a region of temperate ice must form in the margin, and that (ii) lateral advection of ice may play a significant role in controlling migration speeds.