Abstract This study presents a Machine Learning (ML) model for automatic rock classification in the TAS (Total Alkali-Silica) plot. Instead of the 3 required oxides to classify a rock in the TAS plot (SiO2, Na2O, K2O), we use a total of 10 major and minor oxides in an ML model. This allows to (i) classify rocks for which no SiO2 concentrations have been reported, which is often the case for solution based methods where SiO2 is lost in the process of dissolution, and (ii) classify rocks in which alkali element concentrations were affected by e.g., secondary or late-stage hydrous alteration. A hybrid optimised model, trained on a combination of GEOROC and synthetic datasets has an excellent accuracy when tested on GEOROC, synthetic, and PetDB datasets, with accuracies of 99.5%, 99.2%, and 97%, respectively. A modified ML model to classify rocks for which no SiO2 is reported has almost the same accuracy, with a drop by only 2 percent-points to 97.2% during training. And the modified ML model to classify rocks in which alkali oxides have been altered has accuracies with an average of ∼77%. Overall, these findings suggest that ML models are capable of classifying rocks according to the TAS plot, even when no SiO2 has been reported, or, at least to some extent, when alkalis have been redistributed. Future improvements could include additional trace elements to enhance the model’s accuracy for rocks where no SiO2 is available and fluid-immobile elements for rocks where alkali oxides were altered.