Wash the jars, lids, and rings with warm, soapy water. Rinse them thoroughly and place them in a large pot filled with water. Bring the water to a boil and keep the jars submerged for at least 10 minutes to sterilize them. Leave them in the hot water until needed.
In a medium saucepan, combine vinegar, water, salt, and sugar. Bring the mixture to a boil and let it simmer for a few minutes until the salt and sugar dissolves.
Remove the sterilized jars from the hot water using jar tongs or kitchen towels. While the jars are still hot, pack them tightly with prepared pickles, leaving about ½ inch of headspace at the top. You can pack whole pickles, spears, or slices, depending on your preference.
Add the spices.
Carefully pour the boiling brine into the jars, ensuring that the pickles are fully submerged and the headspace is maintained. Use a plastic or wooden utensil to remove any air bubbles trapped within the jar by running it along the sides.
Wipe the rims of the jars with a clean, damp cloth to remove any residue or brine. Place the sterilized lids on top and screw on the rings, ensuring they are snug but not overly tight.
Once all the jars are filled and sealed, place them in a canning pot or a large stockpot filled with boiling water. Make sure the jars are fully immersed, with at least an inch of water above them. Bring the water to a gentle boil and process the jars for the recommended time based on your recipe.
After the processing time is complete, turn off the heat and carefully remove the jars using jar tongs. Place them on a clean kitchen towel or a cooling rack, leaving some space between them. Allow the jars to cool completely.
Once the jars are cooled, check if they are properly sealed. Press down on the center of the lid. If it does not flex and makes a popping sound, the jar is sealed. Any unsealed jars should be refrigerated and consumed within a few weeks.
Finally, label each jar with the date and contents. Store the sealed, properly processed jars in a cool, dark place such as a pantry or cellar. Properly canned pickles can typically be stored for up to a year, but it's best to consume them within the first six months for optimal quality.