Collision Domain is the group of computer devices that are connected to each other in a topology where every packet transmitted over the network has the potentiality to collide on the network link. The 802.3 network uses the CSMA/CD method to send data through a collision domain. In the 802.3 network, only one device suppose to send a frame over the network when it finds that no other devices is using the link, i.e. the network is free. But the collision happens when two (or multiple) devices sense the network as free and start sending frames. The frames then collides.
Broadcast Domain is the concept where every device connected to a network is able to reach out to all other devices with a single message sent using a special messaging, known as broadcast message. In 802.3 network, by default, every device is part of the broadcast domain as they listen to every data frame sent over that network. In the broadcast domain, every Network Interface Card (NIC) receives every frame transmitted over but discards all but the one addressed to itself. The exception is the broadcast message which is accepted by every NICs. Thus, in a broadcast domain, any device can reach out to every device at any point of time.
Ethernet Hub is a dumb device that forwards every Ethernet frame to all other ports in it thus creating a large single collision domain for the devices connected to its ports. This also creates a single broadcast domain for the connected devices. Essentially, it’s like a bus topology where all the devices are connected to a thick cable.
Ethernet Switch creates multiple collision domains, determined by the number of ports in it i.e. a single collision domain with the devices that are connected to a single port. When a device sends a frame to another device connected to the switch, it forwards the frame only to the port at which the the destination device is connected to. In that way, if multiple devices are connected to each other (like a Star of Stars topology) then those devices connected to that port, forms one single collision domain. In the other hand, all the devices connected to a switch form a single broadcast domain, i.e. one device still can reach out to all the devices connected to the switch using a single broadcast message. So it can be said that an Ethernet switch creates a single broadcast domain while breaking that into a multiple collision domains.
Router breaks both the collision and broadcast domain into a single port level. That means, every device connected its one port creates a collision domain and a broadcast domain. The purpose of a router is to connect multiple networks, thus one port of a router creates a single collision domain for that network as well as a single broadcast domain. The network connected to the router decides on its internal detail. All the broadcast packets are dropped at the router.