A firewall can be either a program (software) or a piece of equipment (hardware) that acts as a digital traffic copy for a network or computer by controlling which information goes in and comes out. This means that firewalls will not permit hackers to send information to the computer(s) they protect nor will they allow malware to use the network to send data out to the internet. Software firewalls protect only the computer on which they are installed while hardware firewalls generally protect the entire network. A combination of the two types of firewalls offers an additional layer of security.
If you use a router to connect to a broadband internet service its likely that a firewall is all built into it.