Remove any loose outer pieces of papery skin from the heads of garlic. Slice off the top ⅓ of each head to expose the cloves inside (save the pieces of garlic cloves that have been cut off to use in other recipes).
Place the garlic in a baking dish. Drizzle olive oil over the cut surfaces of the garlic, making sure they're coated in oil.
Cover the baking dish tightly with a lid or foil and transfer to the oven. Roast for 30 minutes, then check the garlic. Add more time in the oven, 10-15 minutes at a time, until the garlic is deeply golden brown. Total roasting time will vary with the size and number of garlic heads you're roasting, as well as the type of dish you're roasting in.
Let the garlic cool. Once cool enough to handle, squeeze the soft roasted garlic out of the heads. Use immediately, store in the refrigerator, or freezer for later use.