The purpose of a for loop is to execute a block of code a specific number of times. It is often used when you need to perform a repetitive task with a known number of iterations.