Noise generated by the discharge of handguns and rifles without adequate protection will result in permanent damage to your hearing.
Physical shockwaves do most of the damage to your hearing. Any device that blocks or absorbs the shockwave can protect the ear.
Damage to hearing can occur when the ears are exposed to sustained levels of sound over 120dB. A .22 rim fire rifle has a sound pressure level of 126dB. Ear muffs will provide 23dB of protection while combining them with foam ear plugs will yield 29dB of protection. Custom earplugs, which provide a decibel reduction of approximately 25dB, are more comfortable than muffs, and are more convenient in the field. They are available from most audiologists who dispense hearing aids.