In geometry, a line segment is a portion of a line that has two endpoints and contains all points in between. A line segment has a specific length, in contrast to a line, which extends infinitely in both directions. A line segment is typically shown by a straight line connecting its endpoints.