Accurate prognostic prediction for head and neck cancer (HNC) is important for the improvement of clinical management. We aimed to compare the prognostic value of various machine learning techniques (MLTs) and statistical Cox regression model for different types of HNC. Clinical data of HNC patients were extracted from the Surveillance, Epidemiology, and End Results (SEER) database from 1974 to 2016. The prediction performance of five ML models, including random forest (RF), gradient boosting decision tree (GBDT), support vector machine (SVM), neural network (NN) and deep learning (DL), were compared with the statistical Cox regression model by estimating the concordance index (C-index), integrated Brier score (IBS), time-dependent receiver operating characteristic (ROC) curve and the area under the curve (AUC). Our results showed that the RF model outperformed all other models in prognostic prediction for all tumor sites of HNC, particularly for major salivary gland cancer (MSGC, C-index: 88.730±0.8700, IBS: 7.680±0.4800), oral cavity cancer (OCC, C-index: 84.250±0.6700, IBS: 11.480±0.3300) and oropharyngeal cancer (OPC, C-index: 82.510±0.5400, IBS: 10.120±0.1400). Meanwhile, we analyzed the importance of each clinical variable in the RF model, in which age and tumor size presented the strongest positive prognostic effects. Additionally, similar results can be observed in the internal (6th edition of the AJCC TNM staging system cohort) and external validations (the TCGA HNC cohort). The RF model is a promising prognostic prediction tool for HNC patients, regardless of the anatomic subsites.