The commonly used practice of putting a cap on a toothbrush is actually detrimental. That’s because moisture entrapment created by the cap can favor bacterial growth. 
(You’ve probably heard the story about toothbrushes and toilets. The theory goes that even if it is several feet away, airborne germs from a toilet flush will infect your toothbrush with fecal bacteria. It sounds pretty scary, and many people now make sure to close the cover of their toilet before they flush. The problem is that this approach alone can cause people to miss the real source of worrisome germs—the brush itself. Studies have discovered that your toilet may be one of the cleaner parts of your house — another scary thought — but as your toothbrush spends a lot of time removing bacteria, it ends up coated with it!  If you have a strong immune system you should be fine, but simply keeping your toothbrush away from the toilet is not an effective way to keep it hygienic. What the bacteria on your toothbrush really need in order to thrive is moisture.)
So if you really want to avoid germs on your toothbrush, the best thing you can do is keep it dry.
You know, those toothbrush caps in the picture kind of look like toilets . . . .