Angle Between Two Lines Calculator

Find the acute and obtuse angles where two lines cross, from their general form coefficients.

Math and PercentUpdated 2026-11-183 min read
Angle Between Two Lines Calculator
Acute angle
...
Obtuse angle...
Cosine of the acute angle...
Tangent of the acute angle...
Slopes of the two lines...
Relationship...

What it does

When two straight lines cross they form two pairs of equal angles. The smaller one is the acute angle and the larger one is its supplement. ProofWiki states the slope formula for the angle between two lines and also gives a general form version, so the result does not depend on which equation shape you start with.

The cleanest route uses normal vectors. For a line written as Ax + By + C = 0, the pair (A, B) points at right angles to the line. A set of planar analytic geometry notes from Babes-Bolyai University derives the cosine of the angle between two lines from the dot product of their direction vectors, and the same dot product works with normals. Taking the absolute value picks the acute angle.

The constant terms C1 and C2 set where each line sits but never change its direction, so they cannot affect the crossing angle. Shifting a line up or down leaves the angle with another line exactly as it was. This page still asks for both constants so that every general form equation is written out fully.

The tool reports the acute angle, the obtuse angle, the cosine, the tangent, both slopes and a short relationship line. The relationship tells you at a glance whether the lines are parallel, perpendicular or simply crossing.

Angles are in degrees, the usual choice in geometry and drafting. Coordinates and coefficients are plain numbers, so there is no unit selector. Write each line with all terms on one side before entering its three coefficients.

How to use

  1. Write both lines in general form, Ax + By + C = 0, with every term on the left.
  2. Enter A1, B1 and C1 for the first line, keeping the signs.
  3. Enter A2, B2 and C2 for the second line.
  4. Read the acute angle first, then the obtuse angle beside it.
  5. Check the cosine and tangent if you want to reproduce the result by hand.
  6. Read the relationship line to see if the lines are parallel or perpendicular.

Formula

cos(theta) = |A1 A2 + B1 B2| / (sqrt(A1^2 + B1^2) x sqrt(A2^2 + B2^2)). theta = arccos of that value. tan(theta) = |(A2 B1 - A1 B2)/(A1 A2 + B1 B2)|. The obtuse angle is 180 degrees minus theta.
A1, B1
Coefficients of x and y in the first line.
C1
Constant term of the first line; it does not affect the angle.
A2, B2
Coefficients of x and y in the second line.
C2
Constant term of the second line; it does not affect the angle.
theta
The acute angle between the two lines, in degrees.

Each pair A, B cannot both be zero, since that would not describe a line. The formula uses the normal vectors (A1, B1) and (A2, B2), whose dot product is A1 A2 + B1 B2. When that dot product is zero the lines are perpendicular and the tangent is undefined, which the page notes rather than printing a number. When the absolute cosine is one the lines are parallel or coincident and the acute angle is zero. Scaling one equation by a constant changes nothing.

Worked example

Example: x - y + 2 = 0 and 2x - y - 3 = 0

Defaults: A1 = 1, B1 = -1, C1 = 2, A2 = 2, B2 = -1 and C2 = -3.

  1. First line has slope minus A1 over B1, which is 1. Second line has slope 2.
  2. Normal lengths are sqrt(1 + 1) = 1.4142 and sqrt(4 + 1) = 2.2361.
  3. Dot product of normals is 1 x 2 + (-1) x (-1) = 3.
  4. Cosine of the acute angle is 3 / sqrt(10) = 0.9487.
  5. Arccosine gives the acute angle 18.4349 degrees, so the obtuse angle is 161.5651 degrees.
  6. Tangent check: |(2 - 1)/(1 + 2 x 1)| = 1/3 = 0.3333, which matches arctan(1/3).
  7. The tool shows acute angle 18.4349°, obtuse angle 161.5651°, cosine 0.9487, tangent 0.3333, slopes 1, 2 and an intersecting relationship.

Reference table

Angles for selected pairs of slopes
Slopes m1, m2Acute angleRelationship
1, 218.4349°Intersecting at an acute angle
1, -190°Perpendicular
2, 20°Parallel
0, 145°Intersecting at an acute angle

Limits

  • Applies to straight lines in a flat plane, not to curves or to lines in three dimensions.
  • Returns the acute angle and its supplement; it does not choose a directed angle.
  • The constants C1 and C2 are ignored for the angle, so two coincident lines read as parallel.
  • Very large coefficients are rejected to keep the square roots and ratios stable.

Common mistakes

  • Forgetting the absolute value and reporting a negative angle.
  • Using the slope formula on a vertical line, where the slope is undefined.
  • Mixing up which coefficient goes with x and which with y in general form.
  • Reporting only the obtuse angle when the question asks for the smaller crossing angle.
  • Assuming the constant terms change the angle; they only move the line.

Try it yourself

Quick checks. Answers sit tucked under each question.

Find the angle between y = 3x and y = 5x.

The slopes are 3 and 5, so tan of the acute angle is |(5 minus 3)/(1 + 15)| = 2/16 = 0.125. The acute angle is 7.125° and the obtuse angle is 172.875°. In general form the lines are 3x - y = 0 and 5x - y = 0.

Two lines have normals (3, 4) and (4, -3). What is the angle?

The dot product is 3 x 4 + 4 x (-3) = 0, so the lines are perpendicular and the acute angle is 90°. The tangent is undefined and the tool says so.

Line one is x + y = 0 and line two is x + y = 7. What angle do they make?

Both have the same coefficients A = 1 and B = 1, so they are parallel. The cosine is 1 and the acute angle is 0°, even though the constants differ.

Questions

Which angle does the calculator return?

The acute angle, from 0 to 90 degrees, together with its supplement from 90 to 180 degrees.

Do the constant terms matter?

No. They move a line without turning it, so only A and B affect the angle.

How do I enter a vertical line?

Use A = 1, B = 0 for x = k, or any nonzero A with B = 0. The page handles the vertical case through the normal vector.

What does a zero dot product mean?

The normal vectors are perpendicular, so the lines themselves are perpendicular and the angle is 90 degrees.

Can I use slopes instead?

The tangent relation with slopes is equivalent. This page takes general form coefficients so vertical lines need no special case.

What if the two lines are the same?

The angle is zero and the page labels them parallel. It does not distinguish coincident lines from distinct parallel lines.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.