The identification and control of features influencing traffic crashes have become a concern in safety and human factor engineering. The decision tree algorithm can play an effective role in the identification of these features by discovering hidden patterns in traffic crash data. The present study was conducted to identify the most important features influencing the prediction of the types of crashes on a freeway in Iran using the decision tree algorithm. Reports were collected on 2039 traffic crashes on the freeway during 2015–2017. Each crash report form included 35 features, each of which had more sub-features. To optimize the features, the participle swarm optimization (PSO) approach was adopted. The remaining features from the optimization process were analyzed based on the decision tree algorithm in MATLAB. Applying PSO, 13 features were introduced to the decision tree algorithm. Based on the calculations of the algorithm, a decision tree model was constructed. The model demonstrated that seven features generated the highest separation for determining crash types on the freeway, including the complete cause of the crash, road surface conditions, the geometry of the crash location, weather conditions, time of the crash, the human component, and helmet/safety belt. The overall prediction accuracy of the model was found to be 72.21%. The prediction accuracy of the model was also separately calculated for different types of crashes. The prediction accuracy results were 93.62%, 64.20%, and 65.47% for fatal, injury, and damage crashes, respectively. This study can be regarded as the intersection of crash data, data mining, safety sciences. The results can be used to develop strategies and control/supervision plans in order to reduce crash and injury rates.