Communication plays a major part in everything be it proficient or individual. Because of its widespread use, accessibility, affordability, and free services, email is a popular communication tool. The rise in email-based attacks is a direct result of email protocol weaknesses as well as the growing volume of electronic commerce and financial activities. One of the main issues with today's Internet is email spam, which can financially harm businesses and bother individual consumers. On the internet, spam emails are the main problem. Spammers find it simple to send emails that are filled with spam. Our inbox is flooded with several pointless emails from spam. We receive an overwhelming volume of spam emails every day, making it difficult and time-consuming for us to distinguish between them. Spam remains a problem despite all the efforts made to eradicate it. Furthermore, even valid emails will be removed from consideration when countermeasures become excessively sensitive. Filtering is one of the key strategies among the methods created to prevent spam. This research aims to explore machine learning algorithms and their application to our data sets. The optimal algorithm for email spam detection is chosen based on its optimal precision and accuracy.