The fragmentation of magma, containing abundant gas bubbles, is thought to be the defining characteristic of explosive eruptions. When viscous stresses associated with the growth of bubbles and the flow of the ascending magma exceed the strength of the melt, the magma breaks into disconnected fragments suspended within an expanding gas phase. Although repeated effusive and explosive eruptions for individual volcanoes are common, the dynamics governing the transition between explosive and effusive eruptions remain unclear. Magmas for both types of eruptions originate from sources with similar volatile content, yet effusive lavas erupt considerably more degassed than their explosive counterparts. One mechanism for degassing during magma ascent, consistent with observations, is the generation of intermittent permeable fracture networks generated by non-explosive fragmentation near the conduit walls. Here we show that such fragmentation can occur by viscous shear in both effusive and explosive eruptions. Moreover, we suggest that such fragmentation may be important for magma degassing and the inhibition of explosive behaviour. This implies that, contrary to conventional views, explosive volcanism is not an inevitable consequence of magma fragmentation.