We consider the problem of maximizing the mean–variance utility function of n assets. Associated with a change in an asset's holdings from its current or target value is a transaction cost. These must be accounted for in practical problems. A straightforward way of doing so results in a 3n-dimensional optimization problem with 3n additional constraints. This higher dimensional problem is computationally expensive to solve. We present an algorithm for solving the 3n-dimensional problem by modifying an active set quadratic programming (QP) algorithm to solve the 3n-dimensional problem as an n-dimensional problem accounting for the transaction costs implicitly rather than explicitly. The method is based on deriving the optimality conditions for the higher dimensional problem solely in terms of lower dimensional quantities and requires substantially less computational effort than any active set QP algorithm applied directly on a 3n-dimensional problem.