In this paper, we explore machine learning (ML) methods to improve inflation forecasting in Brazil. An extensive out-of-sample forecasting exercise is designed with multiple horizons, a large database of 501 series, and 50 forecasting methods, including new machine learning techniques proposed here, traditional econometric models and forecast combination methods. We also provide tools to identify the key variables to predict inflation, thus help opening the ML black box. Despite the evidence of no universal best model, the results indicate that machine learning methods can, in numerous cases, outperform traditional econometric models in terms of mean-squared error. Moreover, the results indicate the existence of nonlinearities in the inflation dynamics, that are relevant to forecast inflation. The set of top forecasts often include forecast combinations, tree-based methods (such as random forest and xgboost), breakeven inflation, and survey-based expectations. Altogether, these findings offer a valuable contribution to macroeconomic forecasting, especially, focused on Brazilian inflation.