Boogers are formed when snot, or nasal mucus, dries up and forms into a mass of green substance in the nose. Mucus is the thin, slippery material that is found inside your nose. The human nose makes nearly a cupful of snot every day. Snot is produced by the mucous membranes in the nose, which it moistens and protects.
When you inhale air through your nose, it contains lots of tiny particles, like dust, dirt, germs, and pollen. If these particles made it all the way to the lungs, the lungs could get damaged and it would be difficult to breathe. Snot works by trapping the particles and keeping them in the nose.
After these particles get stuck inside the nose, the mucus surrounds them along with some of the tiny hairs inside the nose called cilia. The mucus dries around the particles. When the particles and dried-out mucus clump together, you're left with a booger!
Boogers can be squishy and slimy or tough and crumbly. In fact, boogers are a sign that your nose is working properly.