This paper is devoted to the question of optimal portfolio construction for equity factor investing. The first part focuses on how to make sure that a given equity portfolio has the targeted factor exposures, even before imposing any constraints. We show that such portfolios can be derived from mean–variance optimization using expected stock returns as inputs, provided these are built in a robust way from information about the factors. We propose a framework to build those robust expected stock returns and show that the targeted factor exposures are retained by the portfolios both before and after applying realistic constraints, eg, long only. Other, more simplistic, approaches fail. The second part illustrates the application of the framework to a practical case, where the objectives are, first, to decide on the risk-budget allocation to factors in some pragmatic way and, second, to construct a long-only constrained portfolio that retains the targeted exposures to four factors from well-known asset-pricing equity models, namely high-minus-low (HML), robust-minus-weak (RMW), conservative-minus-aggressive (CMA) and momentum (MOM).