TL;DR
Pull the rubber gasket out of the lid every time you wash it -- the channel it sits in is the one part of a jar that never gets clean otherwise, and it is where dark growth appears first. Wash the ring and the groove separately in hot soapy water with a small brush, and let both dry completely before putting the gasket back.
Why the gasket groove is the weak point
A sealing lid works because a soft ring is compressed into a rigid channel. That fit has to be tight, which means there is no gap for water to flush through and no way for a sponge to reach inside.
Every time the jar is opened, a little of whatever was inside gets past the edge of the ring and into the channel. It stays there, warm and damp, in the dark.
That combination is why a jar that looks clean can smell sour, and why the first dark specks in any storage container appear along the gasket line rather than on the glass.
The problem is universal to any lid with a seal -- water bottles, food storage boxes, travel mugs, and jars all share it. Hidden grooves and seals are a recurring failure point across kitchen gear, covered in the guide to cleaning kitchen tools without damaging them.
How do you clean a jar lid with a rubber gasket?
Pull the gasket out of its groove with a fingernail or a blunt plastic tool, then wash the ring on both sides and scrub all the way around the empty channel with a small brush in hot soapy water. Rinse both thoroughly, dry them separately and completely, and only then press the ring back in.
The routine
1. Remove the gasket every wash. Not occasionally -- every wash. Lift an edge with a fingernail, a toothpick, or a blunt plastic tool. Do not use a knife tip, which nicks the rubber and ruins the seal.
2. Wash the ring on both faces. The underside, which sits against the glass, and the top, which sits in the channel. Both carry residue.
3. Scrub the whole channel. A small nylon brush or a toothbrush all the way around, twice. Hot water and dish soap.
4. Do the rest of the lid. The threads, the underside, and any hinge or clamp mechanism. Threads collect a surprising amount.
5. Rinse everything with hot water. Soap left in a groove is itself sticky and holds the next round of residue.
6. Dry both pieces separately and fully. This is where most people fail. A gasket pressed back into a damp channel traps water in exactly the place you just cleaned.
7. Reassemble only when dry, and store jars with the lid off or loose rather than sealed.
Dealing with dark growth in a gasket
Dark specks or a black line along a gasket are common in seals that have been washed with the ring left in place.
Remove the ring and wash both it and the channel in hot soapy water with a brush. Mechanical scrubbing plus hot water removes most of what is there.
For staining that remains, soak the gasket and the lid in one part white vinegar to three parts water for thirty minutes, or scrub with a baking soda paste. Use one method or the other. Never combine cleaning products, and specifically never combine bleach with ammonia, with vinegar or any other acid, or with rubbing alcohol, because each of those releases a toxic gas.
Rinse thoroughly with hot water afterward and dry completely.
If the rubber is permanently discolored, cracked, hardened, or no longer springs back when pressed, replace it. Replacement gaskets are inexpensive and widely available, and a perished ring does not seal properly anyway.
Cleaning reduces residue and moisture that allow growth to take hold on a lid. It does not treat, prevent, or cure anything, and mold growing in a building is an entirely different problem that belongs to a remediation professional rather than to a cleaning routine.
Different lid types
Two piece canning lids have a flat disc with a sealing compound around the rim and a separate screw band. The discs are single use for home canning, though they can be reused for dry storage. Wash and dry the bands thoroughly, since they rust where water sits between the band and the jar.
One piece storage lids with a silicone liner. The liner usually pops out. If it does not, do not force it, and instead brush around the edge of the liner and rinse repeatedly with hot water.
Clamp top jars with a wire bail and a thick rubber ring. The ring lifts straight off the glass lid. Clean the wire mechanism too, since it collects grime at the pivots and rusts.
Plastic screw lids. No gasket, but the threads and the small recess at the top of the thread hold residue.
Molds and seals for frozen items behave the same way, described in how to clean popsicle molds.
Can jar lids go in the dishwasher?
Glass jars and most plastic and silicone lids are dishwasher safe on the top rack, and dishwasher water temperature helps.
The critical point is that a dishwasher does not clean a gasket channel with the ring left in place. Water cannot get into a compression seal, which is the entire point of the design. Remove the ring and place it separately, or the machine achieves nothing where it matters most.
Metal canning bands can go in a dishwasher but should be dried right away, since they rust readily.
Preventing the problem
Store jars with the lid off or resting loose. A sealed empty jar traps humidity, and that is enough to start growth over weeks.
Dry everything completely before assembling. Ten minutes on a towel and then air drying open is enough.
Wash lids as soon as the jar is emptied, rather than leaving a lid with residue on it in a cupboard.
Replace tired gaskets. A ring that has gone hard or is permanently stained is at the end of its life.
Check the threads and the rim of the jar too. Sticky residue on the glass rim transfers straight back into the clean channel.
The same drying rule applies to any container that holds oily or sugary contents, in how to clean an oil dispenser bottle, and to reusable drinkware with silicone parts, in how to clean reusable straws and their brushes.
Source: USDA Food Safety and Inspection Service guidance on food storage containers and spoilage
FAQ
How do you clean the rubber seal in a jar lid?
Pull the gasket out of its channel with a fingernail or a blunt plastic tool, then wash both faces of the ring and scrub all the way around the empty groove with a small brush in hot soapy water. Rinse hot, dry both pieces separately and completely, and reassemble only when dry.
Why is there black stuff on my jar gasket?
Because the ring was left in its channel during washing, so residue and moisture stayed trapped in a warm dark groove. Remove the ring, scrub both it and the channel, and if staining persists soak in a mild vinegar solution or scrub with baking soda paste, never both.
Can jar lids go in the dishwasher?
Most can, on the top rack, but a dishwasher cannot clean a gasket channel with the ring still in place, because a compression seal is designed to keep water out. Remove the ring and wash it separately. Dry metal canning bands immediately, since they rust.
When should you replace a jar gasket?
When the rubber is cracked, hardened, permanently discolored, or no longer springs back after being pressed. A perished ring does not seal, and it holds residue in its surface texture. Replacement gaskets are inexpensive and available for most common jar types.
How do you stop jars smelling musty in storage?
Store them with the lid off or resting loose rather than sealed, and never assemble a jar until every part is bone dry. A sealed empty jar traps humidity, which is enough over weeks to produce a stale smell along the gasket line.
Can you reuse canning lids?
The flat sealing discs used in home canning are single use for canning, because the sealing compound is compressed once. They are fine for dry storage afterward. The screw bands are reusable indefinitely, provided they are washed, dried immediately, and not rusted or bent.
Lids and seals are a two minute job when the ring comes out. The kitchen and pantry around them take longer. If you would rather hand that off, get a quote or read more about house cleaning services.