Calculators.Life Calculator
Math

Number Line Calculator

Input Parameters

Scenarios
The starting or left point on the number line.
Endpoint representation on the number line
The ending or right point on the number line.
Endpoint representation on the number line

Computed Results

Distance Between Points
7
Midpoint-0.5
Interval Notation[-4, 3]
Inequality Notation-4 ≤ x ≤ 3

The number line calculator determines the exact distance and midpoint between any two values. By selecting open, closed, or arrow endpoints, it automatically generates the correct interval notation and inequality notation for your mathematical range.

How to Use the Number Line Calculator

Follow these steps to calculate the properties of a segment or ray on a number line:

  1. Enter the Left Point (x₁): Input the starting numerical value.
  2. Select the Left Endpoint Style: Choose whether the point is closed (includes the number), open (excludes the number), or an arrow (extends to infinity).
  3. Enter the Right Point (x₂): Input the ending numerical value. If you enter a smaller number here, the calculator will automatically sort the points from smallest to largest.
  4. Select the Right Endpoint Style: Choose the appropriate endpoint representation for the right side.
  5. Review the Results: The calculator will display the distance, midpoint, and the mathematical notations for your defined range.

Formulas and Notation Rules

The calculator uses standard algebraic formulas to find the distance and midpoint between two coordinates on a one-dimensional number line.

Distance Formula

Distance is the absolute value of the difference between the two points. This ensures the distance is always a positive number.

Distance = |x₂ − x₁|

Midpoint Formula

The midpoint is the exact center between the two values, calculated by averaging the two points.

Midpoint = (x₁ + x₂) ÷ 2

Interval and Inequality Notation

The calculator generates notation based on the endpoint styles you select:

Inputs and Outputs

FieldTypeDescription
Left Point (x₁)InputThe starting or left numerical value on the number line.
Left Endpoint StyleInputThe visual representation of the left boundary (closed, open, or arrow).
Right Point (x₂)InputThe ending or right numerical value on the number line.
Right Endpoint StyleInputThe visual representation of the right boundary (closed, open, or arrow).
Distance Between PointsOutputThe total absolute length between the two specified points.
MidpointOutputThe exact middle coordinate between the two points.
Interval NotationOutputThe mathematical representation of the range using brackets and parentheses.
Inequality NotationOutputThe mathematical representation of the range using greater-than and less-than symbols.

Verified Scenario Walkthroughs

Here are examples of how the calculator processes different types of number line segments and rays:

Simple Open Interval Between Positive Integers

If you set the left point to 5 (open) and the right point to 10 (open), the distance is 5 and the midpoint is 7.5. Because both endpoints are open, the interval notation is (5, 10) and the inequality notation is 5 < x < 10.

Negative Range with Mixed Endpoint Styles

For a left point of -25 (closed) and a right point of -10 (open), the distance is 15 and the midpoint is -17.5. The mixed styles result in an interval notation of [-25, -10) and an inequality notation of -25 ≤ x < -10.

Left-Bounded Ray Extending to Infinity

If you input a left point of 0 (closed) and a right point of 50 (arrow), the calculator treats the right side as extending infinitely. The interval notation becomes [0, ∞) and the inequality notation is x ≥ 0.

Extreme Values with Inverted Input Order

If you enter the points out of order—such as a left point of 95 (open) and a right point of -95 (closed)—the calculator automatically sorts them from smallest to largest while keeping the correct endpoint styles attached to their respective numbers. The sorted range is from -95 (closed) to 95 (open). The distance is 190, the midpoint is 0, the interval notation is [-95, 95), and the inequality notation is -95 ≤ x < 95.

Practical Use Cases

This tool is useful for translating visual number line graphs into formal mathematical notation. It helps students and educators quickly verify homework related to absolute value, coordinate geometry, and algebraic inequalities. It is also helpful for determining the domain and range of functions, where expressing boundaries correctly with open or closed intervals is required.

Frequently Asked Questions

What is the difference between an open and closed endpoint?

A closed endpoint means the specific number is included in your range, represented by a solid dot on a number line. An open endpoint means the number is a boundary but is not included in the range itself, represented by a hollow circle.

Does it matter which number I enter first?

No. The calculator automatically sorts the two numbers from smallest to largest. It also ensures that the endpoint style you selected for a specific number stays attached to that number after sorting.

How do I represent a line that goes on forever?

Select the 'arrow' option for either the left or right endpoint style. This tells the calculator that the range extends to negative infinity (left arrow) or positive infinity (right arrow).

Author portrait
About the Author
Arnab Biswas

Calculator developer and SEO strategist who builds practical online calculators and tests calculation logic, input handling, and expected results using real-world scenarios.