The basic purpose of a layer 2 switch is to break up collision domains.
Layer 2 switches operate at the Data Link layer of the OSI model and use MAC addresses to forward data frames to the appropriate devices within a local area network (LAN). By doing so, they reduce collisions by creating separate collision domains for each connected device. However, they do not break up broadcast domains; that function is performed by routers or layer 3 devices.