Line Reflection Calculator – Mirror a Point Across Any Line
A line reflection creates a mirror image of a point on the opposite side of a fixed line, at the same perpendicular distance. Unlike a point reflection (which mirrors through a single center), a line reflection uses an entire line — an axis, a diagonal, or any arbitrary line — as the axis of symmetry. This calculator supports reflections across the x-axis, y-axis, y = x, y = −x, custom slope-intercept lines, lines defined by two points, and vertical or horizontal lines.
The General Reflection Formula
Every line can be written in standard form ax + by + c = 0. Given a point P(px, py), the calculator first finds the foot of the perpendicular from P to the line:
k = (a·px + b·py + c) / (a² + b²)foot_x = px − a·kfoot_y = py − b·k
The foot F is the midpoint between P and its reflection, so doubling it and subtracting the original point gives the mirrored coordinates:
reflected_x = 2·foot_x − pxreflected_y = 2·foot_y − py
Special Cases: Axes and Diagonals
For common lines, the general formula simplifies considerably. Reflecting across the x-axis (y = 0) negates the y-coordinate: (x, y) → (x, −y). Reflecting across the y-axis (x = 0) negates the x-coordinate: (x, y) → (−x, y). Reflecting across y = x swaps the coordinates: (x, y) → (y, x). And reflecting across y = −x swaps and negates both: (x, y) → (−y, −x). For example, the point (3, 4) reflects to (3, −4) across the x-axis, (−3, 4) across the y-axis, (4, 3) across y = x, and (−4, −3) across y = −x.
Vertical and Horizontal Lines
A vertical line x = c only flips the x-coordinate: reflected_x = 2c − px, reflected_y = py. A horizontal line y = c only flips the y-coordinate: reflected_x = px, reflected_y = 2c − py. For instance, reflecting (5, 3) across x = 2 gives (−1, 3), and reflecting (4, 7) across y = 3 gives (4, −1).
Slope-Intercept and Two-Point Lines
For a line in slope-intercept form y = mx + b, the calculator rewrites it as mx − y + b = 0 (so a = m, b_coeff = −1, c = b) before applying the general formula. For a line defined by two points, the standard-form coefficients are derived directly from the coordinates of both points, which is useful when you know two points on a mirror line rather than its slope and intercept.
Common Applications
- Coordinate geometry education — understanding lines of symmetry and perpendicular projections
- Computer graphics — mirroring shapes or sprites across an arbitrary axis
- Optics and physics — modeling how light or particles reflect off a straight surface
- CAD and vector design — generating symmetric control points across a reference line
Precision and Accuracy
Calculations use standard 64-bit floating-point arithmetic, accurate to about 15 significant digits. You can choose a display precision from 2 to 6 decimal places. Very steep slopes (magnitude above 10,000) can introduce numerical instability in slope-intercept mode — switch to vertical-line mode for an exact result in that case.