Coffee is imperfect. Take a field of coffee from the best estate in the world, harvest and process it and you'll have a range of coffee from objectively terrible, to pretty decent, to glorious beans that hold the promise of orchards in your cup. There are as many different ways to grade coffee as there are countries that produce it. We're going to look at five factors that affect the resulting brew in the cup: size, density, bean quality, cup quality and age.

SIZE

Many African beans are graded by their size. A is the largest size in Kenya and Tanzania followed by B, which are usually sold together with A to become AB. Sometimes there's also an E size, which is larger than A, then there are C and T sizes and it all gets a bit silly. Generally AA (size A mixed with more size A) is the grade to go for because roasting coffee beans of the same size makes for a more consistent roast. Think of how you need to cut potatoes to the same size when roasting to get them to cook at the same rate. If the beans are of various sizes in the roaster, the smaller ones will burn and the larger will remain less roasted in the middle. For roast consistency, all the beans need to be is of a consistent size. Larger beans don't necessarily mean better tasting coffee.

Instant coffee producers need cheap coffee to be able to still make a profit after selling their product cheaply, so they'll go for the objectively terrible beans, mixed in with some decent beans for the coffee flavour. Size won't be an issue. 

Peaberry

Usually in the coffee cherry, there are two seeds that come out, like the seeds in a peanut, with a flat side and a round side. Peaberries occur when only one seed develops inside the cherry. Peaberry used to be considered a defect and is now often sought-after because the somewhat rounder beans tend to roast more evenly than their flat-sided brethren.

Size sorting

Hand-held screens for sorting bean size. These particular ones are used by the family at Ponto Alegre, Minas Gerais to grade samples of their crop.

Hand-held screens for sorting bean size. These particular ones are used by the family at Ponto Alegre, Minas Gerais to grade samples of their crop.

Sizes are usually graded by screens. These can be hand-held or be huge screens at the end of conveyor belts.

DENSITY

In Central America, beans are often graded according to the altitude at which they are grown. Beans grown at higher altitude tend to be denser than beans grown at lower levels. The highest grade beans in Costa Rica and Guatemala are Strictly Hard Bean (SHB), with varying grades of Good Hard Bean or simply Hard Bean for the next level down. Each country has its own idea about how high SHB is.

Higher altitudes means colder average temperatures and slower maturing fruit. This results in denser beans, which tend to have brighter acidity. The right height for bright beans depends on the distance from the equator and the local weather patterns. Density is a good thing to judge a coffee on, because denser beans roast more evenly. However, higher altitude might make for harder llamas, but it doesn't necessarily equate to denser coffee and a microclimate in the Galapagos could produce great coffee at near sea level.

Density sorting

Most density sorting is done on Oliver tables that shake the beans along an angled table top. The denser beans rise up and the lighter beans and debris fall to the other side of the table. The streams are separated into different sacks and sent for further grading.

A less common sorter uses the inertia of the moving bean to separate the heavier beans from the lighter ones by catching them at different levels across a gap as in the last image in the carousel gallery below.

Bean quality

Usually, like a healthy incredible hulk, a healthy bean is large and looks pumped. If the bean has brown patches, is black, has bits nibbled out of it, it's more super-villan that will taint an entire brew, than coffee hero.

Defects

The best thing that the Speciality Coffee Association of America ever did was publish a book on coffee defects. It's not the most comprehensive list of defects out there, but it's a good standard to go off and, with thick card and ample spacing, it's a great field handbook. In it there are descriptions of green bean defects along with pictures of the defect and space for your own sample to do a side-by-side comparison. The defects this book covers are blacks, sours, cherry pods inclusion, fungus damage, foreign matter, insect damage, parchment, floaters, immature beans, withered beans, shell, broken beans, and husk.

SCAA Defects Handbook

Grading protocols

The SCAA Defects Handbook is also a protocol for grading coffee. It's a good one. However, it's not the only grading system in the world and most commodity coffee is graded using the Brazilian/New York grading system. This system takes a 300 g sample of beans, counts up the number of defects in this sample, and references three charts to get a score between 100 and -200. It's worth noting that with only 4 small rocks in your sample, you get a score of 100 – it takes 360 full defects to get the miserable score of -200.

Before around 2010 it was very difficult to get hold of zero-defect coffee and it wasn't uncommon to discover bits of metal, corn and human teeth in your coffee. Bits of metal in the coffee was so common a problem that some grinders had a strong magnet in the hopper – to catch safety pins before they fell into the grinder burrs. Happily, both grading systems should now be redundant for speciality coffee – there shouldn't be any defects in the coffee.

Defect sorting

Density sorting tables (Oliver tables) will separate many of the defects out, however there are very sophisticated machines that can measure the colour of hundreds of beans a second and send a blast of air to direct discoloured beans to a different chute. The iSort Z6 has 384 chutes for different shades of coffee and will process 8-15 tonnes of coffee per hour with greater than 99.9% accuracy.

Many mills use workers to hand sort the beans. Hand sorting isn't just something for poor countries where labour is cheaper than equipment; hand sorters are often used in addition to other defect detectors because people (usually women) are good at picking out the remaining few defects that slipped through the other grading measures.

Cup quality

Not all beans are graded care of the SCAA and some defects cannot be detected by inspection. Some beans are graded solely by cupping. The Brazilian bloke below is cupping 10 cups of the same coffee at a time. He'll award each coffee a grade depending on how many of the cups taste fine out of 10. He's not cupping Cup of Excellence here. He's looking for really foul tasting defects like drain water and pork scratchings.

Age

Some cheeky roasters pretend to be speciality and buy cheap past-crop coffee. This is coffee that once could have been speciality, but has sat around in a warehouse too long and become past-crop. Past crop tends to give muted fruit flavours, but with the wrapping paper left on. The best coffee I ever tasted was picked and drunk within three weeks. This doesn't mean that coffee older than a few months is past it as Michael Palin's ex-parrot, but I wouldn't buy green coffee more than few months after harvest. However, fancy vacuum packaging and Grainpro bags stored in climate-controlled warehouses do extend the life of green coffee well beyond a year.

What to buy

Coffee is a drink and if you're roasting for the speciality market, you should be roasting for flavour and tactile qualities. If you're buying zero-defect coffee, just because it's zero-defect coffee, then you might end up with a coffee that could compete in the Olympics, but you're more likely to end up with Bruce, 43, overweight and single, 25 ciggies a day and whisky dependency, because Bruce also has no obvious physical defects. Buy recently harvested coffee beans that are all the same size with no defects and have great flavour. Density is an important variable because heat conducts more quickly through denser objects, but denser coffee might not correlate with higher altitude.