There are a few ways. You can freeze the whole cloves in an airtight freezer-friendly container for up to 3 months. Or, you can mash them first and flatten them into a thin layer and freeze them that way. Finally, you can freeze mashed garlic in ice cube trays for individual portions. This is great for when you need just a bit for a single recipe.