The use of renewable energy sources is increasing due to national and international regulations. Such energy sources are less predictable than most of the classical energy production systems, like coal and nuclear power plants. This causes a challenge for balancing the electricity system. A possibility to meet this challenge is to use the flexibility in electricity demand for balancing with unpredictable electricity supply. In this paper we briefly present an approach to incorporate flexibility into demand response and present the generic MIRABEL information model for expressing flexibility in consumption or distributed generation. In addition, we focus on an ontology for flexibility in smart grids thatwas designed on the basis of the MIRABEL information model. This ontology is represented inOWL and defines the objects involved in flexibility and their relationships. Thereby, this ontology gives a semantically better view on the flexibility concept and its meaning in relation to the building on the one hand and the smart grid on the other hand. Moreover, this ontology forms the basis for a vocabulary that can be published via the web and used to connect IT systems from various stakeholders in the energy domain that handle supply and demand of energy. © 2012 Taylor & Francis Group.