There is growing interest in estimating and analyzing heterogeneous treatment effects in experimental and observational studies. We describe a number of meta-algorithms that can take advantage of any machine learning or regression method---such as the Nadaraya-Watson estimator, BART, Random Forest, or Neural Networks---to estimate the conditional average treatment effect (CATE) function. We introduce a new meta-algorithm, the X-learner, that can exploit structural properties of the CATE function. For example, we prove that if the CATE function is linear, but the response functions only satisfy that they are Lipschitz continuous, the X-learner can still achieve the parametric rate. Moreover, unlike alternatives, the learner uses information efficiently if the sample sizes in the treatment and controls groups are unequal. We then introduce a version of the X-learner that uses Random Forests, because it is widely believed that Random Forests automatically adapt to structural properties such as sparsity, and it is possible to obtain approximate confidence intervals. Even though none of the meta-learners is uniformly the best, in our simulations the X-learner performs favorably to other meta-methods. Several political science data examples are examined.