The effectiveness of a mask depends on the type of mask
There are two common types that are FDA regulated: surgical masks and N95 respirators.
A surgical mask, also known as a medical mask, is typically loose-fitting and disposable that includes specified layers of material that are moisture resistant. They are mostly designed to provide protection against large droplets that form through activities like sneezing. However, most surgical masks do not filter small particles and due to its loose-fitting design—forms a leakage of airflow around the edge of the mask.
N95 respirators are tight-fitting disposable masks that are designed to form a seal on your face and includes a specialized filter that captures at least 95 percent of particles that are 0.3 microns or larger that pass through it. They are more effective than surgical masks as they can filter both small and large particles and form the above mentioned sealing fit around your face.
Between these two types of masks, it is the N95 respirator that is greatly recommended for protection. In a case of a pandemic, however, shortages of these regulated masks can ensue which leads to the need and use of alternatives, most commonly through cloth masks and coverings.