Technically, the masks don't necessarily keep the germs in either. They reduce the amount that gets out by catching much of the carrier droplets and also reduce the travel distance of the ones that do get through. They aren't perfect, which is why it's still a good idea to distance yourself from others, even if everyone is wearing a mask. That and not touching your face before washing/sanitizing your hands first will go a long way toward reducing your risk.
Bookmarks