Typically, nasal mucus is clear and thin, and its main job is to filter air as you suck it in through your nostrils. But during an infection, mucus can change to a yellow or green color as a result of how your body is trying to fight off the bacteirial or viral infection.