Skip to content
ihateDesmos

How to make a line segment in Desmos

Updated 6 November 2026 · An independent guide, not from Desmos

To make a line in Desmos, type its equation: y = 2x + 1. To make it a segment that stops at both ends, add a restriction in curly braces: y = 2x + 1 {0 < x < 3}.

What to type
y = 2x + 1 {0 < x < 3}(1 + 3t, 2 + 6t)
−4−224−22460
Open in calculator
Two segments: one sloped, and one vertical.

Step by step

  1. 1
    For a full line, type y = 2x + 1.
  2. 2
    For a segment, add the range of x in curly braces: y = 2x + 1 {0 < x < 3}.
  3. 3
    For a vertical line, type x = 3. For a horizontal one, type y = 2.

A segment between two exact points

To go from (a, b) to (c, d), use (a + (c - a)t, b + (d - b)t). Since t runs from 0 to 1 by default, it starts at the first point and stops at the second. This method handles any segment, including a vertical one.

Dashed lines

Click and hold the coloured icon beside the expression to choose a dashed or dotted line, and to change its thickness.

From two points to an equation

If you have two points but no equation, use the slope calculator. For how the numbers in y = mx + b work, see slope-intercept form.

Frequently asked questions

How do I make a line segment in Desmos?
Add a restriction, y = 2x + 1 {0 < x < 3}, or use a parametric equation between the two points.
How do I draw a vertical line in Desmos?
Type x = 3. To limit its length, add a condition on y: x = 3 {0 < y < 5}.
How do I make a dashed line?
Click and hold the coloured icon next to the expression, and choose the dashed style.

Keep going

Or try it in ihateDesmos

The same equations work here, with algebra, steps and exports built in. It is free, with no account.

Open the calculator