Buying whole beans is ideal if you have a quality grinder. However, if you don’t, it’s better to purchase pre-ground coffee from a roaster or ask a barista to grind it for you.