Bacteria are wildly underrated. From farming to flavoring, these microbes are essential in ways you probably didn’t even realize. There are three other stories in this series about art restoration, E. coli’s role in biology and medicine, and bacterial fertilizers.

Vinegar has been helping humans preserve foods and clean houses for thousands of years. But a perhaps unexpected culprit is responsible for this ubiquitous acid: bacteria.

The aptly named acetic acid bacteria are the variety of microbes solely responsible for the production of the acid that characterizes vinegar. These microorganisms take ethanol, guzzle it up for fuel, and release molecules of acetic acid directly into the developing mixture—which means vinegar is basically bacteria compost.

In ancient times, the condiment was often a by-product of the fermentation of alcoholic beverages. Its original name “vin aigre” simply means “sour wine” in French. Even after it became a process unto itself, the production method was essentially controlled spoilage. Producers would fill wood barrels three-quarters of the way full of the desired ethanol source, leaving holes at the end of the barrel covered with a fine screen to let in oxygen. The acetic acid bacteria were introduced to the mixture from the air, from the raw material mixture, or were simply left over from the previous batch.

The different varieties of vinegar available depend on the starting material. Apple cider vinegar starts with apple cider as the main sugar source; malt vinegar starts with malt grain; balsamic vinegar starts with whole crushed grapes. Yeast first need to ferment these sugars into ethanol, at which point acetic acid bacteria can take over. The production of wine vinegars begins with the typical wine fermentation process, which is then taken a step further with the addition of acetic acid bacteria. Red wine, white wine, rice wine, and champagne can all transform into their vinegar counterparts through this method.

This entire process takes anywhere from one to three months. The investment of time, however, allows for the slow development of a rich flavor and aroma and yields a high quality vinegar, according to a 2008 study from researchers at University of Ljubljana in Slovenia.

Today, though, most vinegar isn’t made by French artisans using wooden barrels. Industrial scaling requires massive, stainless steel vats. Once the sugars are fermented, producers add one of four kinds of acetic acid bacteria: Acetobacter, Gluconacetobacter, Gluconobacter and Komagataeibacter. Then a little bit of oxygen is pumped in to kickstart the microbes, and constantly aerate and stir the mixture at a precise temperature (generally 86 degrees Fahrenheit) to ensure optimal bacteria functionality. Over the next 24 to 48 hours, the bacteria completely replace the ethanol with acetic acid.

[Related: Grime-loving bacteria could save priceless art]

At the end of the process, the acidic mixture is diluted with water to achieve the desired quality and flavor. In the United States, the Food and Drug Administration requires the final product to be at least four percent acetic acid by volume in order to be sold as “vinegar.” Five percent acidity is standard, while most wine and balsamic vinegars fall in the six to seven percent range. Anything above 15 percent is reserved for cleaning and weed killing.

Like wine, beer, and cheese, all of this takes advantage of what these little microbes do naturally. Acetic acid bacteria are powerhouses at converting ethanol to acetic acid because it’s where they get their energy. 

During conversion, the bacteria strip electrons from the ethanol molecules, then use those electrons to power their own cellular machinery. They can do this efficiently because all of the machinery required is anchored on the surface of their cell membrane. The ethanol molecules don’t have to go through the arduous process of entering the cell, being converted, and leaving the cell again; all the enzymatic action takes place right there on the surface. 

Like all of the tiny interactions happening in a single cell at any given time, the conversion performed by acetic acid bacteria requires very specific operating conditions to most efficiently churn out vinegar. Simply tossing microbes into a vat of ethanol won’t do the trick; in addition to constantly aerating the mixture, the temperature must be carefully controlled.

To help with this, researchers are exploring thermotolerant strains of these bacteria, meaning particular strains that exhibit optimal performance at temperatures higher or lower than the typical 86 degrees Fahrenheit. 

In hot places, producers must invest in a cooling system to ensure the bacteria remain cool enough to operate, while colder regions face the opposite problem. On both ends, energy input and proper infrastructure are key for ensuring the bacteria remain comfortable. The introduction of thermotolerant strains has the potential to eliminate the need to invest energy in heating and cooling, making the process more sustainable and cost effective overall.

Despite the advances of modern chemistry, the vinegar industry has yet to encounter a promising challenger to the tried-and-true natural machinery of acetic acid bacteria. With even more versatile strains to uncover and their accessibility as an abundant inhabitant of the microscopic world, we’ll be relying on these tiny organisms to stock our shelves with vinegar for years to come.