In this work we develop a conceptual design for an integrated facility that produces biodiesel using solar and/or wind energy and carbon dioxide. Microalgae are grown to accumulate lipids that are extracted. The methanol needed for the transesterification is synthesized from carbon dioxide and electrolytic hydrogen. The electricity for the complex is produced using solar panels or wind turbines. The flowsheet is formulated as a multiperiod mixed-integer nonlinear programming problem whose solution provides the optimal source of energy and the operating conditions over a year for an average production of 60 Mgal/yr of biodiesel. The facility requires an investment of 120 M(sic) for a production cost of 0.79 (sic)/gal (0.25 (sic)/kg). The energy consumption is 3.2 MI/gal of biodiesel capturing 4.05 kg of carbon dioxide per kg of biodiesel and consuming 1L/L of water including the operation of the cooling tower and the boiler. (C) 2017 Elsevier Ltd. All rights reserved.