A sandbag or dirtbag is a bag or sack made of hessian (burlap), polypropylene or other sturdy materials that is filled with sand or soil and used for such purposes as flood control, military fortification in trenches and bunkers, shielding glass windows in war zones, ballast, counterweight, and in other applications requiring mobile fortification, such as adding improvised additional protection to armored vehicles or tanks.
The advantages are that the bags and sand are inexpensive. When empty, the bags are compact and lightweight for easy storage and transportation. They can be brought to a site empty and filled with local sand or soil. Disadvantages are that filling bags is labor-intensive. Without proper training, sandbag walls can be constructed improperly causing them to fail at a lower height than expected, when used in flood-control purposes. They can degrade prematurely in the sun and elements once deployed. They can also become contaminated by sewage in flood waters making them difficult to deal with after flood waters recede. In a military context, improvised up-armouring of tanks or armored personnel carriers with sandbags is not effective against cannons (though it may offer protection against some small arms).
Sandbags have traditionally been filled manually using shovels. Since the 1990s, machine filling has become more common, allowing the work to be done more quickly and efficiently.
Properly stacked sandbags are an effective deterrent against damaging flood waters. Sandbags can be used to build levees, barricades, dikes and berms to limit erosion from flooding. Sandbags can also be used to fortify existing flood control structures and limit the effects of sand boils. Sandbag structures do not prevent water seepage and therefore should be built with the central purpose of diverting flood water around or away from buildings.
Properly filled sandbags for flood control are filled one-half to two-thirds full with clean washed sand. In an emergency, if clean sand is in limited supply, gravel or dirt can also be used with less effective end results. When filled sandbags are stacked or laid in place, the contents need to settle flat to the ground. Sandbags filled over two-thirds full will not form an adequate seal to the ground or structure. Likewise sandbags filled under one-half will generally also form an inadequate seal to the ground when placed.
The best practices for filling sandbags require a three-person team. One team member will crouch down and hold open the bag to form a collar opening. The second team member places the tip of a pointed shovel with sand into the opened sandbag. A square shovel is not recommended as the blade of the shovel will not fit into the sandbag when filling. The third team member will transport and stockpile the filled sandbags.
Properly placed sandbags will be set lengthwise and parallel to the water flow with the folded or open end of the sandbag facing upstream. All loose debris should be removed from the placement surface and the lowest areas are the first spots to be filled in with sandbags. Each bag must be set consecutively with the tightly packed bottom slightly overlapping the previously placed sandbag. Subsequent layers of bags should be offset by 1/2 the length of a sandbag to eliminate voids and improve the wall seal. Each placed bag should be tamped and flattened to improve the seal.
The two primary methods for stacking sandbags to build flood control structures are the (1) Single Stack placement, and; (2) Pyramid Placement Method.
The military uses sandbags for field fortifications and as a temporary measure to protect civilian structures. Because burlap and sand are inexpensive, large protective barriers can be erected cheaply. The friction created by moving soil or sand grains and tiny air gaps makes sandbags an efficient dissipator of explosive blast. The most common sizes for sandbags are 14 by 26 inches (36 by 66 cm) to 17 by 32 inches (43 by 81 cm). These dimensions, and the weight of sand a bag this size can hold, allow for the construction of an interlocking wall like brickwork.
Individual filled bags are not too heavy to lift and move into place. They may be laid in excavated defences as revetment, or as free-standing walls above ground where excavations are impractical. As plain burlap sandbags deteriorate fairly quickly, sandbag structures meant to remain in place for a long time may be painted with a portland cement slurry to reduce the effects of rot and abrasion. Cotton ducking sandbags last considerably longer than burlap and are hence preferable for long-term use. However, the vast majority of sandbags used by modern military and for flood prevention are made of circular woven polypropylene. Some of the World War I memorial trenches were rebuilt with concrete sandbags after the First World War—although criticized as looking unnatural, they have lasted well. During World War II in Great Britain, some aircraft revetments and pillboxes were made from concrete filled sandbags, again these have lasted well.
Sandbag fortifications have been used since at least the late 16th century. For example, the rebellious Mughal governor Mirza Jani Beg used improvised sandbags made out of boat sails to construct a makeshift fort at Unarpur, Sindh, in 1592. Later, British loyalists used sandbag and log fortifications in the 1781 Siege of Ninety-Six during the American Revolutionary War. Nathanael Greene was familiar enough with the fortification technique to equip his troops with hooks to pull down the sandbag and log walls when they stormed the Star Redoubt in Ninety Six, South Carolina.
In ancient times, temporary sandbag forts known as an antestature were made out of sandbags.They were historically hastily established by a retreating force to slow the progress of the enemy. The word comes from the Latin ante ("before"), and statūra ("a standing"). 
Bulk bags, also known as big bags, are much larger than traditional sandbags. Moving a bag of this size typically requires a forklift truck. Bulk bags are usually made of woven or non-woven geotextiles.
Large bags of sand are often used in flood control and making temporary patches to water barriers. For example, Thailand utilized bulk bags filled with sand to erect temporary walls to protect against the 2011 Thailand floods.
Sandbags are also used for disposable ballast in gas balloons, and as counterweights for theatre sets. Some temporary construction signs or advertising signs are held in place and secured against being blown over with sandbags.
During World War II, sandbags were also used as extemporized "soft armor" on American tanks, with the goal of protecting the tanks from German anti-tank rounds, but they were largely ineffective.
Sandbags can also be carried within vehicles to provide improved traction during inclement weather (typically stored above the drive wheels where the increased weight improves traction). If ever stuck, sand can be removed and placed directly onto the slippery surface thereby providing greatly improved traction. Sandbags are also used by off-road enthusiasts instead of sand plates or sand ladders to assist the vehicle to get traction and momentum after being stuck in soft sand. The same sandbags can be used to bridge deep holes or ditches. Apart from being very light and taking very little space (when empty), the sandbags are a much cheaper option than any of the other options (sand plates, sand ladders, multipurpose bags, etc.).
Sandbags are often used to temporarily stabilize soil from erosion, such as oceanfront structures whose foundations have been undermined by heavy waves. Sandbags are also used in earthbag construction to make inexpensive, environmentally sustainable homes. In addition, sandbags are often used when shooting a long gun, specifically a rifle or sniper rifle, from a rest, as it provides support for the weapon, allowing for less movement during shooting.
Sandbags of various sizes and weights can be used for exercise or resistance training.
Sandbags are used for safety in film, video and theatrical production. Sandbags are often used as easily portable weight to lower the center of gravity of a Light stand or a C-Stand where heavy items are placed at the top of a high stand often having a small base. Shot bags are another type of flexible weight used for the same purpose.
In games and various kinds of adversarial settings, the term sandbagging refers to the practice of purposely placing oneself in a weaker position so as to give the deceptive impression that one is less skilled than one truly is.
The word can also refer to a simple weapon consisting of a small bag filled with sand for use as a cudgel typically by criminals, or to the act of striking a person on the head with such a weapon. This usage is obsolescent in normal speech, appearing mainly in legal codes. However the verb form is extended metaphorically in several slang expressions.