This article proposes a technical definition for nearly zero energy buildings required in the implementation of the Energy Performance of Buildings Directive recast. Energy calculation framework and system boundaries associated with the definition are provided to specify which energy flows in which way are taken into account in the energy performance assessment. The intention of the article is to help the experts in the Member States in defining the nearly zero energy buildings in a uniform way. The directive requires nearly zero energy buildings, but since it does not give minimum or maximum harmonized requirements as well as details of energy performance calculation framework, it will be up to the Member States to define what these for them exactly constitute. In the definition local conditions are to be obviously taken into account, but the uniform methodology can be used in all Member States. The directive defines nearly zero energy building as a building that has a very high energy performance and requires the calculation of primary energy indicator. The nearly zero or very low amount of energy required should be covered to a very significant extent by energy from renewable sources, including energy from renewable sources produced on-site or nearby. Based on the directive’s definition, nearly zero energy building is technically defined through the net zero energy building, which is a building using 0 kWh/(m² a) primary energy. Following the cost-optimality principle of the directive, nearly net zero energy building definition is proposed as national cost optimal energy use of > 0 kWh/(m² a) primary energy. In order to end up with proposed general definition, it was needed to clarify which energy flows shall be included in energy performance assessment and how the primary energy factors should be used for primary energy indicator calculation. For the uniform methodology, a general system boundary definition was established with inclusion of active solar and wind energy, as well as the guidance for technical meaning of “nearby” in the directive.