Random forest is an ensemble machine learning algorithm that combines multiple decision trees to improve predictive accuracy. It works by constructing many decision trees during training and outputting the class that is the mode of the classes of the individual trees. Random forest can be used for both classification and regression problems and provides high accuracy even with large datasets.