The basic purpose of a layer 2 switch is:
To break up collision domains.
Layer 2 switches operate at the data link layer and are designed to forward frames based on MAC addresses while also reducing collision domains, thereby enhancing network performance. They do not break up broadcast domains, which is the function of routers.