It is now understood that machine learning algorithms can produce unintentionally biased results. For the last few years, legal scholars have been debating whether the disparate treatment or disparate impact theories available under Title VII of the Civil Rights Act are capable of protecting against algorithmic discrimination. But machine learning scholars are not waiting for the legal answer. Instead, they have been working to develop a wide variety of technological “fairness” solutions that can be used to constrain machine learning algorithms. They have discovered that simply blinding algorithms to protected characteristics like sex or race is insufficient to prevent algorithmic discrimination. Given enough data, algorithms will identify and leverage on proxies for the protected characteristics. As a result, some scholars have proposed “fairness through awareness” or “algorithmic affirmative action”—actively using sensitive variables like race or sex to achieve some mathematical measure of fairness in algorithmic decisions. But is algorithmic affirmative action legal? This article is the first to comprehensively consider that question under both Title VII and the Equal Protection clause of the Fourteenth Amendment. The article evaluates the legality of the leading fairness techniques advanced in the machine learning literature, including group fairness, individual fairness, and counterfactual fairness. The article concludes that existing affirmative action doctrine under Title VII and existing constitutional equal protection jurisprudence leave sufficient room for at least some forms of algorithmic affirmative action.