1) Keep them INSIDE!
The most pets go missing on the 4th of July due to fireworks fright. Keep them inside. If you do need to take your pet outside, use a leash and walk outside with them so there is no chance of escape.
2) Keep a collar with ID tag on your pets
Even though you should keep them happy & safe inside, you never know when a dog or cat may find an escape and dash outside. Having a collar with ID on them will at least alleviate that concern if they do get outside.
3) Don't react
As difficult as it can be, try not to react if they get upset about the noise from fireworks. Pets can pick up on our emotions very easily and so if you are nervous or afraid they may be, too. Instead, be confident and happy, and hopefully they pick up on those emotions! Don't baby your pet most importantly. This petting and soothing only reinforces to them that if they act "this way", then they get attention. Do the opposite. Ignore them completely. We know it is IMPOSSIBLE, but try!
4) Keep the noise out
Try putting your pet in a covered crate and maybe in a room with a radio turned on or music playing, and a fan blowing. Windows closed! It may help drown out the noises and help to keep them calm. If they can't hear it, they can't react.
5) Try a calming supplement or medication
Some pets just get too worked up from fireworks. There is no calming them, no matter what you may try. You can try a calming supplement/treat, or if that doesn't work, you may want to discuss options with your veterinarian. Each dog or cat is different from the other so the same supplement or medication doesn't work the same for all.