Gleaning is the act of collecting leftover crops from farmers' fields after they have been commercially harvested or on fields where it is not economically profitable to harvest. It is a practice described in the Hebrew Bible that became a legally enforced entitlement of the poor in a number of Christian kingdoms.
According to the Book of Deuteronomy and Leviticus, farmers should leave corners of their fields unharvested (pe'ah), should not pick up that which was dropped (gleanings), and should not harvest any over-looked produce that had been forgotten when they harvested the majority of a field. On one of the two occasions that this is stated in Leviticus, it adds that in vineyards, some grapes should be left ungathered, a statement also found in Deuteronomy.
These verses additionally command that olive trees should not be beaten on multiple occasions, and whatever remains from the first set of beatings should be left. According to Leviticus, these things should be left for the poor and for strangers, and Deuteronomy commands that it should be left for widows, strangers, and paternal orphans. The Book of Ruth tells of gleaning by the widow Ruth to provide for herself and her mother-in-law, Naomi, who was also a widow.
In classical rabbinic literature, it was argued that the biblical regulations concerning left-overs only applied to grain fields, orchards, and vineyards. The farmer was not permitted to benefit from the gleanings, and was not permitted to discriminate among the poor, nor try to frighten them away with dogs or lions; the farmer was not even allowed to help one of the poor to gather the left-overs. However, it was also argued that the law was only applicable in Canaan, although many classical rabbinic writers, who were based in Babylon, applied the laws there too; it was also seen as only applying to Jewish paupers, but poor non-Jews were allowed to benefit for the sake of civil peace.
In many parts of Europe, including England and France, the Biblically-derived right to glean the fields was reserved for the poor; a right, enforceable by law, that continued in parts of Europe into modern times.
In 18th century England, gleaning was a legal right for "cottagers", or landless residents. In a small village the sexton would often ring a church bell at eight o'clock in the morning and again at seven in the evening to tell the gleaners when to begin and end work. This legal right effectively ended after the Steel v Houghton decision in 1788.
The Shulchan Aruch argues that Jewish farmers are no longer obliged to obey the biblical rule. Nevertheless, in modern Israel, rabbis of Orthodox Judaism insist that Jews allow gleanings to be consumed by the poor and by strangers during Sabbatical years.
In the modern world, gleaning is practised by humanitarian groups which distribute the gleaned food to the poor and hungry; in a modern context, this can include the collection of food from supermarkets at the end of the day that would otherwise be thrown away. In addition to supermarkets, gleaning events also occur at farms in the field. Volunteers, called gleaners, visit a farm where the farmer donates what is left in their fields to collect and donate to a food bank. In New York State in 2010, this form of gleaning alone rescued 3.6 million pounds of fruits and vegetables. There are a number of organizations that practice gleaning to resolve issues of societal hunger; the Society of St. Andrew, for example, is dedicated to the role.
When people glean and distribute food, they may be bringing themselves legal risk; in the Soviet Union, the Law of Spikelets (sometimes translated "law on gleaning") criminalised gleaning, under penalty of death, or 20 years of forced labour in exceptional circumstances. In the US, the Bill Emerson Good Samaritan Act of 1996 limited the liability of donors to instances of gross negligence or intentional misconduct, alleviating gleaning from much of the risk that was allegedly hampering the delivery of surplus food from restaurants and dining facilities to emergency food centers. The law preempts state Good Samaritan Acts, that provide less protection. 
On the island of Bali, traditional law allows fruit from a tree to be picked by the passerby from the ground - even if the tree is on privately owned land.
Gleaning was a popular subject in art, especially in the nineteenth century. Gleaning in rural France has been represented in the paintings Des Glaneuses (1857) by Jean-François Millet and Le rappel des glaneuses (1859) by Jules Breton (image), and explored in a 2000 documentary/experimental film, The Gleaners and I, by Agnès Varda.
Woolgathering is a practice similar to gleaning, but for wool. The practice, now obsolete, was of collecting bits of wool that had gotten caught on bushes and fences or fallen on the ground as sheep passed by. The meandering perambulations of a woolgatherer give rise to idiomatic sense of the word as meaning aimless wandering of the mind.
Along marine coastlines, gleaning has been defined as "fishing with basic gear, including bare hands, in shallow water not deeper than that one can stand".Invertebrate gleaning (walking) fisheries are common within intertidal seagrass meadows globally, contributing to the food supply of hundreds of millions of people.