A ruler, sometimes called a rule or line gauge, is a device used in geometry and technical drawing, as well as the engineering and construction industries, to measure distances or draw straight lines. 
Rulers have long been made from different materials and in multiple sizes. Some are wooden. Plastics have also been used since they were invented; they can be molded with length markings instead of being scribed. Metal is used for more durable rulers for use in the workshop; sometimes a metal edge is embedded into a wooden desk ruler to preserve the edge when used for straight-line cutting. 12 in or 30 cm in length is useful for a ruler to be kept on a desk to help in drawing. Shorter rulers are convenient for keeping in a pocket.  Longer rulers, e.g., 18 in (46 cm), are necessary in some cases. Rigid wooden or plastic yardsticks, 1 yard long, and meter sticks, 1 meter long, are also used. Classically, long measuring rods were used for larger projects, now superseded by tape measure, surveyor's wheel or laser rangefinders.
Desk rulers are used for three main purposes: to measure, to aid in drawing straight lines, and as a straight guide for cutting and scoring with a blade. Practical rulers have distance markings along their edges.
A line gauge is a type of ruler used in the printing industry. These may be made from a variety of materials, typically metal or clear plastic. Units of measurement on a basic line gauge usually include inches, agate, picas, and points. More detailed line gauges may contain sample widths of lines, samples of common type in several point sizes, etc.
Measuring instruments similar in function to rulers are made portable by folding (carpenter's folding rule) or retracting into a coil (metal tape measure) when not in use. When extended for use, they are straight, like a ruler. The illustrations on this page show a 2 m (6 ft 7 in) carpenter's rule, which folds down to a length of 25 cm (10 in) to easily fit in a pocket, and a 5 m (16 ft) tape, which retracts into a small housing.
A flexible length-measuring instrument which is not necessarily straight in use is the tailor's fabric tape measure, a length of tape calibrated in inches and centimeters. It is used to measure around a solid body, e.g., for a person's waist measurement, as well as for linear measurement, e.g., for the inside leg length. It is rolled up when not in use, taking up little space.
A ruler software program can be used to measure pixels on a computer screen or mobile phone. These programs are also known as screen rulers.
In geometry, a ruler without any marks on it (a straightedge) may be used only for drawing straight lines between points. A straightedge is also used to help draw accurate graphs and tables.
A ruler and compass construction refers to constructions using an unmarked ruler and a compass. It is possible to bisect an angle into two equal parts with a ruler and compass. It can be proved, though, that it is impossible to divide an angle into three equal parts using only a compass and straightedge — the problem of angle trisection. However, should two marks be allowed on the ruler, the problem becomes solvable.
In the history of measurement many distance units have been used which were based on human body parts such as the cubit, hand and foot and these units varied in length by era and location.  In the late 18th century the metric system came into use and has been adopted to varying degrees in almost all countries in the world.
The oldest preserved measuring rod is a copper-alloy bar that dates from c. 2650 BCE and was found by the German Assyriologist Eckhard Unger while excavating at the Sumerian city of Nippur (present day Iraq).
Rulers made of ivory were in use by the Indus Valley civilization period prior to 1500 BCE.  Excavations at Lothal (2400 BCE) have yielded one such ruler calibrated to about 1⁄16 inch (1.6 mm).  Ian Whitelaw holds that the Mohenjo-Daro ruler is divided into units corresponding to 1.32 inches (33.5 mm) and these are marked out in decimal subdivisions with amazing accuracy, to within 0.005 inches (0.13 mm). Ancient bricks found throughout the region have dimensions that correspond to these units. 
The equivalent of a ruler for drawing or reproducing a smooth curve, where it takes the form of a rigid template, is known as a French curve. A flexible device that can be bent to the desired shape is known as a flat spline, or (in its more modern incarnation) a flexible curve. Historically, a flexible lead rule used by masons that could be bent to the curves of a molding was known as a lesbian rule. 
Ludwig Wittgenstein famously used rulers as an example in his discussion of language games in the Philosophical Investigations. He pointed out that the standard meter bar in Paris was the criterion against which all other rulers were determined to be one meter long, but that there was no analytical way to demonstrate that the standard meter bar itself was one meter long. It could only be asserted as one meter as part of a language game.
- Accuracy and precision – Characterization of measurement error
- Dividing engine
- Golomb ruler – Set of marks along a ruler such that no two pairs of marks are the same distance apart
- Measuring instrument – Device for measuring a physical quantity
- Measuring rod
- Rolling ruler
- Significant figures – Any digit of a number within its measurement resolution, as opposed to spurious digits
- Technical drawing tool – Tools and instruments used for accurate and precise manual drafting
- "ruler noun - Definition, pictures, pronunciation and usage notes - Oxford Advanced Learner's Dictionary at OxfordLearnersDictionaries.com". www.oxfordlearnersdictionaries.com. Archived from the original on 25 October 2017. Retrieved 25 April 2018.
- "Steel Rule Has Pocket Clip For Use As A Depth Gauge", Popular Science, December 1935, p. 887 bottom right.
- Klein, Herbert A. The science of measurement: a historical survey. Reprint, unabridged, corr. republ. der Ausg. New York, Simon & Schuster, 1974. ed. New York, NY: Dover, 1988. Print.
- Whitelaw, p. 14.
- Whitelaw, p. 15.
- "Flexible Ruler Invented by Frank G. Hunt". National Museum of National History. Archived from the original on 30 June 2016. Retrieved 7 June 2016.
- "lesbian, adj. and n.". Oxford English Dictionary (Online ed.). Oxford University Press. (Subscription or participating institution membership required.) (subscription required)
- Cherry, Dan. "Collector's guide to rules", Furniture & Cabinetmaking, no. 259, July 2017, ISSN 1365-4292, pp. 52–6
- Rees, Jane and Mark (2010). The Rule Book: Measuring for the Trades. Lakeville, MN: Astragal Press ISBN 978-1-931626-26-2 OCLC 907853704
- Russell, David R.; with photography by James Austin and foreword by David Linley (2010). Antique Woodworking Tools: Their Craftsmanship from the Earliest Times to the Twentieth Century, Cambridge: John Adamson ISBN 978-1-898565-05-5 OCLC 727125586, pp. 64–74
- Whitelaw, Ian (2007). A Measure of All Things: The Story of Man and Measurement. Macmillan ISBN 0-312-37026-1 OCLC 938084552