Blending petroleum fuels with biofuels is likely to become increasingly important over the years to come. Butyl butyrate has promising characteristics as a blend component in diesel and can be synthesized by lipase‐catalyzed esterification of 1‐butanol and butyric acid, which both can be derived from fermentation technologies. In the current study, the enzyme load and reaction temperature were optimized for the production of butyl butyrate with Novozyme 435 (immobilized Candida antarctica lipase B) directly in diesel at a substrate concentration of 1 m using a molar ratio of 1:1 between n‐butanol and butyric acid. Optimum conditions were found by using a central composite design at an enzyme load of 12 % of substrate weight and a temperature of 57 °C, giving 90 % yield conversion in 30 min, corresponding to a butyl butyrate productivity of 1.8 mol L−1 h−1. Diesel blended with 5, 10, and 30 % butyl butyrate was tested in a heavy‐duty diesel engine under two load cases. The ignition properties of the blended fuels were very similar to pure diesel, making butyl butyrate an interesting diesel substitute. The emission analysis demonstrated lower soot and CO emissions, similar hydrocarbons levels and slightly increased NOx levels compared with using pure diesel. The high activity of lipase in diesel and the compatibility between diesel and butyl butyrate opens up the possibility to develop fuel blending systems where the synthesis of the blend‐in component occurs directly in the fuel.