Natural phenomena such as seismicity, volcanism, and fluid circulation in volcanic areas are influenced by the mechanical response of intact basalt. When subjected to a wide range of environmental loading conditions, basalt exhibits inelastic deformation characteristics ranging from brittle to ductile behavior. In this manuscript, we present a new constitutive model of basalt that spans the brittle-ductile transition by covering a wide range of mean effective stress, temperature, and strain rate. The model has been implemented into the automatic constitutive model code generator MFront, which we have coupled with the finite element solver OpenGeoSys. The software employed for the computations is open source, accessible and offers a versatile solution to model thermomechanical failure of rocks. Within this framework, we have performed numerical simulations that highlight the localization of strains and stresses under triaxial compression. Predictions of the constitutive response, of the depth of the brittle-ductile transition, and of the localization patterns are in agreement with laboratory and in situ observations. The results have important geophysical implications as they provide a constitutive basis that explains the mechanisms through which basalt can deform in a brittle fashion at temperatures above 600°C. The mechanical behavior of rocks is commonly split between two idealized limits (