Accurate modelling of the weather’s temporal and spatial impacts on building energy demand is critical to decarbonizing energy systems. Here we introduce a customizable model for hourly heating and cooling demand applicable globally at all spatial scales. We validate against demand from ~5,000 buildings and 43 regions across four continents. The model requires limited data inputs and shows better agreement with measured demand than existing models. We use it first to demonstrate that a 1 °C reduction in thermostat settings across all buildings could reduce Europe’s gas consumption by 240 TWh yr−1, approximately one-sixth of historical imports from Russia. Second, we show that service demand for cooling is increasing by up to 5% per year in some regions due to climate change, and 5 billion people experience >100 additional cooling degree days per year when compared with a generation ago. The model and underlying data are freely accessible to promote further research.