The most general definition of foam is a substance that is formed by trapping many gas bubbles in a liquid or solid. It can also refer to anything that is analogous to such a phenomenon, such as quantum foam. Often people mean polyurethane foam (foam rubber), Styrofoam or some other manufactured foam when they are using the term. It can be considered a type of colloid.
From the early 20th century, various types of specially manufactured solid foams came into use. The low density of these foams made them excellent as thermal insulators and flotation devices, and their lightness and compressibility made them ideal as packing materials and stuffings. Some liquid foams, called fire retardant foams, found use in extinguishing fires, especially oil fires.
Foam, in this case meaning "bubbly liquid", is also produced as an often unwanted by-product in the manufacture of various substances. For example, foam is a serious problem in the chemical industry, especially for biochemical processes. Many biological substances, for example proteins, easily create foam on agitation and/or aeration. Foam is a problem because it alters the liquid flow and blocks oxygen transfer from air (therefore preventing microbial respiration in fermentation processes). For this reason, anti-foaming agent compounds, like silicone oils, are added to prevent these problems.
If foaming is desired, a foaming agent may help.
Foaming around the mouth can be a symptom of rabies in animals. The term sea foam is used to describe the foam that forms on top of seawater from the action of waves. In some ways, leavened bread is foam, as the yeast causes the bread to rise by producing tiny bubbles of gas in the dough.