{"id":66841,"date":"2026-10-15T09:20:26","date_gmt":"2026-10-15T06:20:26","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=66841"},"modified":"2026-10-15T09:20:26","modified_gmt":"2026-10-15T06:20:26","slug":"distance-from-point-to-line-calculator","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/mathematics\/distance-from-point-to-line-calculator\/","title":{"rendered":"Distance from Point to Line Calculator"},"content":{"rendered":"<section class=\"not-prose calculator-box\" aria-labelledby=\"calculator-title\"><div class=\"flex items-baseline sm:items-center justify-between gap-2 sm:gap-3\"><div class=\"flex flex-col sm:flex-row sm:items-center gap-2\"><span class=\"icon icon-calculator text-primary-700! text-base! dark:text-primary-300!\" aria-hidden=\"true\"><\/span><h2 id=\"calculator-title\" class=\"text-lg font-display font-bold\">Find the Perpendicular Distance from a Point to a Line<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"66841\" data-favorite-title=\"Distance from Point to Line\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/mathematics\/distance-from-point-to-line-calculator\/\" data-favorite-excerpt=\"Enter the coordinates of a point and the coefficients of a line in the form Ax + By + C = 0 to find the shortest (perpendicular) distance between them, with full calculation steps.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-geometry\">\n    <span class=\"icon icon-shape-star-empty\" aria-hidden=\"true\"><\/span>\n  <\/button>\n  <div class=\"calcdash-favorite__tip\" aria-hidden=\"true\">\n   <span class=\"favorite-tooltip\" id=\"favorite-tooltip\"><\/span>\n  <\/div>\n  <span class=\"sr-only\" role=\"status\" id=\"favorite-status\"><\/span>\n<\/div><\/div><form action=\"https:\/\/wpcalc.com\/en\/mathematics\/distance-from-point-to-line-calculator\/\" method=\"POST\" class=\"calculator\" id=\"calculator-66841\" data-post=\"66841\"><fieldset class=\"fieldset-input is-2\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"is-single field\" id=\"input-1\"><span class=\"font-semibold\">Point P<\/span><\/div><div class=\"field has-term\" id=\"input-2\"><label for=\"field-2\">x-coordinate (x\u2081)<\/label><div class=\"term\">x\u2081<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"number\" name=\"xcoordinate_x\" id=\"field-2\" aria-describedby=\"calc-info-2\" placeholder=\"3\" step=\"any\" value=\"3\"\/><small id=\"calc-info-2\">Horizontal coordinate of the point.<\/small><\/div><div class=\"field has-term\" id=\"input-3\"><label for=\"field-3\">y-coordinate (y\u2081)<\/label><div class=\"term\">y\u2081<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"number\" name=\"ycoordinate_y\" id=\"field-3\" aria-describedby=\"calc-info-3\" placeholder=\"4\" step=\"any\" value=\"4\"\/><small id=\"calc-info-3\">Vertical coordinate of the point.<\/small><\/div><div class=\"is-single field\" id=\"input-4\"><span class=\"font-semibold\">Line Ax + By + C = 0<\/span><\/div><div class=\"field has-term\" id=\"input-5\"><label for=\"field-5\">Coefficient A<\/label><div class=\"term\">A<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"number\" name=\"coefficient_a\" id=\"field-5\" aria-describedby=\"calc-info-5\" placeholder=\"2\" step=\"any\" value=\"2\"\/><small id=\"calc-info-5\">Coefficient of x in the line equation.<\/small><\/div><div class=\"field has-term\" id=\"input-6\"><label for=\"field-6\">Coefficient B<\/label><div class=\"term\">B<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"number\" name=\"coefficient_b\" id=\"field-6\" aria-describedby=\"calc-info-6\" placeholder=\"-1\" step=\"any\" value=\"-1\"\/><small id=\"calc-info-6\">Coefficient of y in the line equation.<\/small><\/div><div class=\"field has-term\" id=\"input-7\"><label for=\"field-7\">Coefficient C<\/label><div class=\"term\">C<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"number\" name=\"coefficient_c\" id=\"field-7\" aria-describedby=\"calc-info-7\" placeholder=\"1\" step=\"any\" value=\"1\"\/><small id=\"calc-info-7\">Constant term of the line equation.<\/small><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"66841\">Calculate<\/button><button type=\"reset\">Reset<\/button><\/div><div class=\"field is-checkbox hidden!\" id=\"field-auto-calc\"><input type=\"checkbox\" id=\"auto-calc\"><label for=\"auto-calc\">Calculate automatically<\/label><small>If enabled, the result will update automatically when you change any value.<\/small><\/div><div class=\"fieldset-result is-hidden\" aria-labelledby=\"result-title\" aria-live=\"polite\" role=\"region\"> <h3 class=\"result-title bg-gradient-to-r from-primary-50 to-gray-50 dark:from-primary-900 dark:to-gray-800\" id=\"result-title\"><span class=\"icon icon-s-pulse\" aria-hidden=\"true\"><\/span> Your Distance<\/h3><div class=\"result-box\"><div class=\"field-result\" id=\"output-1\"><span class=\"field-title\"><span>Shortest distance from P to the line<\/span><span class=\"result-term\">d<\/span><\/span><span class=\"field-value\" id=\"result-1\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result\" id=\"output-2\"><span class=\"field-title\"><span>Distance squared<\/span><span class=\"result-term\">d\u00b2<\/span><\/span><span class=\"field-value\" id=\"result-2\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-3\"><span class=\"field-title\"><span>Calculation steps<\/span><\/span><span class=\"field-value\" id=\"result-3\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><\/div><div class=\"result-actions\"><button type=\"button\" class=\"copy-link\"><svg viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z\"\/><path d=\"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z\"\/><\/svg><span class=\"copy-link__text\">Copy link to this calculation<\/span><\/button><span class=\"sr-only\" role=\"status\" id=\"copy-link-status\"><\/span><\/div><\/div><a href=\"#respond\" class=\"hidden transition-opacity duration-300 opacity-0 w-50 text-sm justify-center items-center gap-2 px-4 py-2 rounded bg-gray-200 text-gray-700 hover:bg-gray-300\" id=\"leave-comment\"><span class=\"icon icon-comments\" aria-hidden=\"true\"><\/span>Leave a Comment<\/a><\/form><\/section><section id=\"calc-reactions\" class=\"not-prose hidden my-12 bg-gradient-to-r from-primary-50 to-gray-50 border border-indigo-100 rounded-xl px-6 py-4 shadow-sm\" data-post=\"66841\" aria-live=\"polite\" aria-labelledby=\"calc-reactions-title\"><p id=\"calc-reactions-title\" class=\"text-sm text-gray-500 text-center mb-2\">How did this result make you feel?<\/p><div role=\"group\" aria-labelledby=\"calc-reactions-title\" class=\"grid grid-cols-3 sm:flex sm:flex-row sm:justify-around gap-4 sm:items-center sm:flex-wrap\"><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"like\"><span class=\"reaction-count\" data-reaction-count=\"like\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude00 <\/span><span class=\"reaction-description font-medium\">Like <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"helpful\"><span class=\"reaction-count\" data-reaction-count=\"helpful\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\udca1 <\/span><span class=\"reaction-description font-medium\">Helpful <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"confused\"><span class=\"reaction-count\" data-reaction-count=\"confused\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude15 <\/span><span class=\"reaction-description font-medium\">Confused <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"disappointed\"><span class=\"reaction-count\" data-reaction-count=\"disappointed\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude1e <\/span><span class=\"reaction-description font-medium\">Disappointed <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"inaccurate\"><span class=\"reaction-count\" data-reaction-count=\"inaccurate\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\u274c <\/span><span class=\"reaction-description font-medium\">Inaccurate <\/span><\/button><\/div><div id=\"reaction-message\" class=\"hidden mt-8 rounded-md border border-primary-100 bg-white\/50 backdrop-blur-sm px-4 py-2 text-sm text-center shadow-sm\"><\/div><\/section><div class=\"calcdash-ad not-prose calcdash-ad--calc_result calcdash-ad--in-article\"><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-1721569815777345\" data-ad-slot=\"6317458308\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><\/div>\n<style id=\"wpcoderpro-inline-1\">.formula-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section class=\"formula-box\" aria-labelledby=\"formula-title\">\r\n\t<div id=\"formula-title\" class=\"not-prose font-display mb-4\"><span class=\"icon icon-formula\" aria-hidden=\"true\"><\/span><h2>Distance from Point to Line Formula<\/h2><\/div>\r\n\t<figure class=\"not-prose formula\">\r\n\t\t<figcaption class=\"formula-title\">Formula<\/figcaption>\r\n\t\t<div class=\"text-base text-gray-800\" id=\"formula\">\n\\[ d = \\frac{|A x_1 + B y_1 + C|}{\\sqrt{A^2 + B^2}} \\]<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(d\\) \u2014 perpendicular distance from the point to the line (units)<\/li>\n<li>\\(x_1, y_1\\) \u2014 coordinates of the point P<\/li>\n<li>\\(A, B, C\\) \u2014 coefficients of the line \\(Ax + By + C = 0\\)<\/li>\n<\/ul>\n<p>The formula measures how far the point lies from the line along the shortest possible path \u2014 the perpendicular. The numerator evaluates the line's equation at the point, and the denominator \\(\\sqrt{A^2 + B^2}\\) normalizes the coefficients so the result is a true Euclidean distance.<\/p>\n<p>\r\n<\/section>\n<style id=\"wpcoderpro-inline-459\">.calculation-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section id=\"calculation\" class=\"calculation-box\" aria-labelledby=\"calculation-title\">\r\n\t<div id=\"calculation-title\" class=\"not-prose font-display\"><span class=\"icon icon-unordered-list\" aria-hidden=\"true\"><\/span><h2>Distance from Point to Line \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> find the distance from the point P(3, 4) to the line \\(2x - y + 1 = 0\\).<\/p>\n<p>\\[ A x_1 + B y_1 + C = 2 \\cdot 3 + (-1) \\cdot 4 + 1 = 6 - 4 + 1 = 3 \\]<\/p>\n<p>\\[ d = \\frac{|3|}{\\sqrt{2^2 + (-1)^2}} = \\frac{3}{\\sqrt{5}} \\approx 1.342 \\text{ units} \\]<\/p>\n<p><strong>Result:<\/strong> the shortest distance from P(3, 4) to the line is \\(\\frac{3}{\\sqrt{5}} \\approx 1.342\\) units (exactly \\(\\frac{3\\sqrt{5}}{5}\\)), and \\(d^2 = \\frac{9}{5} = 1.8\\) units\u00b2.<\/p>\n<p>\n\r\n<\/section>\n<h2>How to Use the Calculator<\/h2>\n<ol>\n<li>Enter the <strong>x-coordinate (x\u2081)<\/strong> of your point P.<\/li>\n<li>Enter the <strong>y-coordinate (y\u2081)<\/strong> of your point P.<\/li>\n<li>Enter the <strong>Coefficient A<\/strong> \u2014 the number multiplying \\(x\\) in your line equation.<\/li>\n<li>Enter the <strong>Coefficient B<\/strong> \u2014 the number multiplying \\(y\\).<\/li>\n<li>Enter the <strong>Coefficient C<\/strong> \u2014 the constant term.<\/li>\n<li>Read the result: the shortest distance \\(d\\), the distance squared \\(d^2\\), and a step-by-step breakdown of the calculation.<\/li>\n<\/ol>\n<p>If your line is given in slope-intercept form \\(y = mx + b\\), rewrite it first: \\(mx - y + b = 0\\), so \\(A = m\\), \\(B = -1\\), and \\(C = b\\). For a line through two points, first convert it to the form \\(Ax + By + C = 0\\) before entering the coefficients.<\/p>\n<h2>What Is the Distance from a Point to a Line?<\/h2>\n<p>Given a point P and an infinite straight line, there are infinitely many segments connecting P to points on the line. The shortest of these segments is the one perpendicular to the line, and its length is what we call the distance from the point to the line. This is a fundamental concept in analytic geometry with applications in computer graphics, robotics, collision detection, geographic information systems, and optimization.<\/p>\n<p>The formula works for any line written in general form \\(Ax + By + C = 0\\). The expression \\(Ax_1 + By_1 + C\\) is zero exactly when the point lies on the line. When it is not zero, dividing by \\(\\sqrt{A^2 + B^2}\\) \u2014 the length of the normal vector \\((A, B)\\) \u2014 converts the raw value into an actual distance, making the result independent of how the equation is scaled. Multiplying the whole equation by 2, for example, does not change the distance.<\/p>\n<p>A result of <strong>0 units<\/strong> means the point lies exactly on the line. Larger values simply mean the point is farther away; the distance is always non-negative because of the absolute value in the numerator. The perpendicular segment also tells you where the closest point on the line is: it is the foot of the perpendicular dropped from P.<\/p>\n<h2>Assumptions, Limitations and Tips<\/h2>\n<ul>\n<li><strong>The line must be valid:<\/strong> coefficients A and B cannot both be zero; otherwise the equation does not define a line, and the calculator will show an error.<\/li>\n<li><strong>The line is infinite:<\/strong> the distance is measured to the full line, not to a segment or ray. For a segment, the closest point may be one of its endpoints.<\/li>\n<li><strong>Scale invariance:<\/strong> you may multiply A, B and C by any nonzero constant (including negative values) without changing the distance, since the formula normalizes automatically.<\/li>\n<li><strong>Converting from other forms:<\/strong> from \\(y = mx + b\\) use \\(A = m\\), \\(B = -1\\), \\(C = b\\); from two points \\((x_1, y_1)\\), \\((x_2, y_2)\\) use \\(A = y_1 - y_2\\), \\(B = x_2 - x_1\\), \\(C = x_1 y_2 - x_2 y_1\\).<\/li>\n<li><strong>Units:<\/strong> the distance is expressed in the same units as your coordinates, so use consistent units for both axes.<\/li>\n<\/ul>\n<p>Distances between points and lines appear in many related problems. If you are rewriting line equations or solving systems that involve perpendicular lines, the <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/elimination-method\/\">Elimination Method calculator<\/a> can help find intersection points, while expanding expressions such as \\((A x_1 + B y_1 + C)\\)-style products is quick with the <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/foil-method\/\">FOIL method calculator<\/a> or the <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/multiplying-binomials\/\">Multiplying Binomials calculator<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Enter the coordinates of a point and the coefficients of a line in the form Ax + By + C = 0 to find the shortest (perpendicular) distance between them, with full calculation steps.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7],"tags":[23],"class_list":["post-66841","post","type-post","status-publish","format-standard","hentry","category-mathematics","tag-geometry"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/66841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/users\/3168"}],"replies":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/comments?post=66841"}],"version-history":[{"count":1,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/66841\/revisions"}],"predecessor-version":[{"id":67122,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/66841\/revisions\/67122"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=66841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=66841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=66841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}