The increase in Pertamax prices triggered various responses from the public, many of which were expressed through social media X. Due to the large number of opinions that emerged, sentiment analysis proved to be an appropriate way to automatically recognize public opinion trends. This study was conducted with the aim of determining how effective the "Random Forest" and "Support Vector Machine" (SVM) algorithms are in the process of grouping public sentiment regarding the increase in Pertamax prices. The research data was obtained by collecting information from platform X using keywords that match the topic of Pertamax. After filtering and removing duplicates, 5,006 records were obtained which were used as the dataset in this study. The steps of this study include data pre-processing, sentiment classification process, feature extraction using the Term Frequency Inverse Document Frequency (TF-IDF) technique, Using the SMOTE method to balance the number of classes and divide the dataset into categories, then classifying with two algorithms, namely Random Forest and Support Vector Machine (SVM). Confusion matrix is used to assess model performance with various metrics such as accuracy, precision, recall, and F1 score. This study shows that the data is dominated by negative sentiment, amounting to 51.64%, then dominated by positive sentiment at 35.60%, and neutral sentiment reached 12.76%. Before using SMOTE, Random Forest had an accuracy of 73% while SVM reached 75%. After using SMOTE, the accuracy of the Random Forest model increased to 85% and the accuracy of the SVM increased to 89%. This research contributes to improving the quality of sentiment analysis and serves as a reference for future studies; furthermore, it provides stakeholders with an understanding of public opinion trends regarding the price hike of Pertamax, thereby assisting them in decision-making.