Audited 25 May 2026·Last updated 27 Jul 2026·5 citations·Tier 1·0 uses

Absolute Value Calculator

Calculate the absolute value of any real number. Instant results with sign detection and step-by-step arithmetic.

Absolute Value Calculator

Real number to evaluate
Absolute Value
5
Non-negative magnitude of the input
Sign
-1

Background.

The absolute value of a real number measures its distance from zero on the number line, regardless of direction. This concept appears in virtually every branch of quantitative work, from middle-school algebra to graduate-level functional analysis. An absolute value calculator takes any real number as input and returns its non-negative magnitude, stripping away directional sign. The result tells a user how far a value lies from the origin, a question that arises when computing errors, tolerances, deviations, and norms.

Students in algebra and pre-calculus courses search for absolute value calculators when solving equations of the form |x − a| = b or graphing piecewise functions. Engineers use the concept when calculating total harmonic distortion, where the absolute difference between observed and target values must be summed without cancellation. Data scientists rely on the L1 norm—the sum of absolute values—when training robust regression models that are less sensitive to outliers than least-squares methods. Financial analysts occasionally use absolute deviation to measure portfolio tracking error against a benchmark index. The ubiquity of the concept explains why absolute value remains one of the most searched basic mathematical operations.

The modern notation |x| was introduced by Karl Weierstrass in 1841 and has since become the global standard. Before Weierstrass, mathematicians used verbal descriptions or more cumbersome symbols. The formal definition as a piecewise function emerged in the late nineteenth century as part of the arithmetization of analysis, when mathematicians sought to ground calculus in rigorous number theory rather than geometric intuition. Today, the absolute value is defined axiomatically on any ordered field through the three properties of non-negativity, multiplicativity, and the triangle inequality. These properties generalize to abstract metric spaces, where the absolute value becomes a special case of the distance function.

In applied contexts, the absolute value serves as the building block for more sophisticated measures. The mean absolute error (MAE) in forecasting is the average of absolute differences between predicted and actual values. In signal processing, the envelope of a signal is often computed as the absolute value of its analytic representation. Control engineers use absolute value feedback to design systems that respond to magnitude of error without regard to direction. Even in computer graphics, Manhattan distance—the sum of absolute coordinate differences—determines pixel coverage in certain rasterization algorithms. The calculator provides the foundational computation upon which all these advanced applications depend.

The absolute value also plays a critical role in inequality theory. The reverse triangle inequality, ||x| − |y|| ≤ |x − y|, shows that the absolute value function is Lipschitz continuous with constant 1. This means small changes in input produce proportionally small changes in output, a stability property that numerical algorithms exploit. When a calculator evaluates |x| via the equivalent form √(x²), it relies on the fact that the square root function is also monotonic on the non-negative reals, preserving the order structure of the number line. The absolute value is therefore both a metric and a norm, serving as the canonical distance function on the real line and in higher dimensions.

What is absolute value calculator?

Absolute value is a function that maps every real number to its non-negative magnitude. For any real x, the absolute value |x| equals x when x is zero or positive, and equals the negation −x when x is negative. Geometrically, |x| represents the distance between the point x and the origin on the real number line. Because distance is inherently non-negative, the absolute value never returns a negative result. The absolute value function is classified as an even function, meaning |−x| = |x| for all real x. It is also idempotent: applying it twice yields the same result as applying it once, so ||x|| = |x|. The function has a single corner at x = 0, where the derivative does not exist; to the right of zero the slope is 1, and to the left it is −1. These properties make the absolute value a standard example in calculus courses when discussing non-differentiable continuous functions. The range of the absolute value is the interval [0, ∞), and its domain is all real numbers. The subadditivity property |x + y| ≤ |x| + |y| makes it essential in convergence proofs and error analysis across all quantitative disciplines and engineering fields worldwide.

How to use this calculator.

  1. Enter any real number into the input field labeled "Input Value."
  2. The calculator automatically determines whether the number is negative, zero, or positive.
  3. If the input is negative, the calculator multiplies it by −1 to produce the positive magnitude.
  4. If the input is zero or positive, the calculator returns the number unchanged.
  5. Review the "Absolute Value" output for the non-negative magnitude.
  6. Check the "Sign" output to confirm the original direction: −1, 0, or 1.

The formula.

|x| = x, x ≥ 0 ; −x, x < 0

The primary definition of absolute value is the piecewise function: |x| = x if x ≥ 0, and |x| = -x if x < 0. This definition is computationally direct: the calculator compares the input against zero and either returns the input or its additive inverse. For a negative input such as −7.3, the condition x < 0 triggers the second branch, and the calculator returns −(−7.3) = 7.3. For a positive input such as 4.8, the first branch returns 4.8 unchanged. An equivalent algebraic expression is |x| = √(x²), where the radical denotes the principal (non-negative) square root. This form is useful in calculus and analysis because it allows the absolute value to be manipulated algebraically without piecewise case splitting. When x = −5, the computation proceeds as √( (−5)² ) = √25 = 5. The squaring operation eliminates the sign, and the square root restores the non-negative magnitude. This equivalence is proved by observing that x² is always non-negative and that its square root satisfies the same piecewise behavior as |x|. The absolute value satisfies the triangle inequality |x + y| ≤ |x| + |y|, which is fundamental to the construction of metric spaces. To prove it, note that −|x| ≤ x ≤ |x| and −|y| ≤ y ≤ |y|. Adding these inequalities yields −(|x| + |y|) ≤ x + y ≤ |x| + |y|, which is precisely the statement that |x + y| ≤ |x| + |y|. The reverse triangle inequality, ||x| − |y|| ≤ |x − y|, follows by rearrangement and shows that the absolute value function is uniformly continuous on the real line. Dimensional analysis confirms that the output carries the same units as the input. If x is measured in metres, then |x| is also in metres. The function is homogeneous of degree 1: |cx| = |c||x| for any scalar c. This scaling property is essential in physics, where quantities such as displacement and velocity retain their units under absolute value. The piecewise definition, the square-root definition, and the max-definition |x| = max(x, −x) are all equivalent on the real numbers, and each offers computational or theoretical advantages in different contexts.

A worked example.

Example

Consider the input x = −12.4. Because this value is strictly less than zero, the piecewise definition selects the second branch, and the calculator computes |−12.4| = −(−12.4) = 12.4. Using the equivalent radical form, the calculator first squares the input: (−12.4)² = 153.76. It then takes the principal square root: √153.76 = 12.4. Both methods converge to the same result, confirming consistency. The sign output is −1, indicating that the original input was negative. In a practical context, this computation might represent the magnitude of a temperature deviation. If a process must maintain 20 degrees Celsius and the observed reading is 7.6 degrees, the deviation is −12.4 degrees, but the absolute deviation—the quantity used in control-chart limits—is 12.4 degrees. The calculator delivers this magnitude without requiring the user to reason through the sign manually. This result can be verified independently by noting that 12.4 multiplied by itself equals 153.76, confirming the consistency of the square root computation.

x-12.4

Frequently asked questions.

What is the absolute value of zero?
The absolute value of zero is zero. By the piecewise definition, when x = 0 the condition x ≥ 0 is satisfied, so |0| = 0. This is the only real number whose absolute value equals the number itself in a non-trivial way. Geometrically, zero is already at the origin on the number line, so its distance from the origin is trivially zero. The fact that |0| = 0 is also necessary for the absolute value to satisfy the axioms of a norm; specifically, the definiteness axiom requires that the norm of a vector be zero if and only if the vector itself is zero. In the context of real numbers, this means |x| = 0 implies x = 0, and conversely x = 0 implies |x| = 0.
Can the absolute value ever be negative?
No. The codomain of the absolute value function is the set of non-negative real numbers, [0, ∞). The piecewise definition explicitly returns either x (when x is already non-negative) or −x (when x is negative). In the second case, multiplying a negative number by −1 produces a positive number. Therefore, every possible output is either zero or positive. This property is called non-negativity and is the first axiom in the standard definition of an absolute value on a field. It is also why the absolute value is used to measure distance, magnitude, and error: all of these quantities are physically meaningless when negative, so the absolute value provides a mathematically guaranteed non-negative result.
Why is the absolute value function not differentiable at zero?
The derivative of a function at a point measures the slope of its tangent line at that point. For x > 0, the absolute value function is f(x) = x, which has slope 1. For x < 0, it is f(x) = −x, which has slope −1. As x approaches zero from the right, the slope approaches 1. As x approaches zero from the left, the slope approaches −1. Because these one-sided limits disagree, the overall limit does not exist, and the function is not differentiable at x = 0. The graph has a sharp corner at the origin. This example is standard in calculus textbooks because it demonstrates that continuity does not imply differentiability; the absolute value is continuous everywhere but fails to be smooth at exactly one point.
How does the absolute value relate to distance on the number line?
The distance between two real numbers a and b is defined as |a − b|. When b = 0, this reduces to |a|, which is the distance from a to the origin. This definition satisfies the three axioms of a metric: non-negativity, symmetry (|a − b| = |b − a|), and the triangle inequality (|a − c| ≤ |a − b| + |b − c|). Because the absolute value encodes distance, it appears in every quantitative discipline that measures separation or deviation. In statistics, the mean absolute deviation from the mean uses |xᵢ − μ|. In physics, the magnitude of a one-dimensional displacement is the absolute value of the coordinate difference. The absolute value is therefore not merely an algebraic convenience; it is the mathematical foundation of measurement.
What is the triangle inequality for absolute values?
The triangle inequality states that for all real numbers x and y, |x + y| ≤ |x| + |y|. Intuitively, the magnitude of a sum cannot exceed the sum of the individual magnitudes. This is because the terms x and y might partially cancel each other if they have opposite signs, but they can never reinforce each other beyond the sum of their absolute values. The proof proceeds by observing that −|x| ≤ x ≤ |x| and −|y| ≤ y ≤ |y|. Adding these inequalities gives −(|x| + |y|) ≤ x + y ≤ |x| + |y|, which is equivalent to the triangle inequality. The inequality is strict whenever x and y have opposite signs and neither is zero. The triangle inequality generalizes to vectors, matrices, and functions, making it one of the most important inequalities in analysis.
Is |x| the same as √(x²)?
Yes, for all real numbers x, |x| = √(x²), where the radical denotes the principal (non-negative) square root. When x is positive, x² is positive and its square root is x, so both sides agree. When x is negative, x² is still positive, and its square root is the positive number −x, which again equals |x|. When x = 0, both sides are zero. This equivalence is often used in calculus to rewrite absolute values algebraically, avoiding piecewise definitions during differentiation or integration. However, the equivalence does not hold over the complex numbers, where |z| is defined as the modulus √(z·z̄) and z² may not be a non-negative real number. For real inputs, the calculator can use either definition interchangeably.
What is the sign of the absolute value of a negative number?
The absolute value itself is always non-negative, so the sign of the output |x| is either positive (when x ≠ 0) or zero (when x = 0). However, the calculator's separate "Sign" output reports the sign of the original input, not the sign of the absolute value. For a negative input such as −8.2, the absolute value output is 8.2 (positive), while the sign output is −1, indicating that the original number was negative. This dual output is useful in programming and engineering applications where both the magnitude and the direction of a quantity are needed. For example, in motor control, the absolute value might determine speed, while the sign determines rotational direction.
How is absolute value used in statistics?
Absolute value is central to robust statistical measures that resist outlier distortion. The mean absolute error (MAE) computes the average of |predicted − actual| across all observations. Unlike squared error, MAE does not disproportionately penalize large deviations, making it preferable when outliers are expected. The median absolute deviation (MAD) computes the median of |xᵢ − median(x)| and serves as a robust scale estimator. In linear programming, L1 regression minimizes the sum of absolute residuals rather than squared residuals, producing coefficient estimates that are less sensitive to extreme data points. These applications rely on the fact that absolute value preserves the original units of measurement and treats positive and negative errors symmetrically.
What happens when I input a very large number?
The absolute value of any finite real number is well-defined and finite, regardless of magnitude. For inputs near the upper bound of JavaScript's number range (approximately 1.8 × 10³⁰⁸), the absolute value will be the same large number, and the computation involves only a sign check with no loss of precision. However, if the input exceeds Number.MAX_VALUE or is Infinity, the calculator throws an InvalidInputError because Infinity is not a real number and does not have a finite absolute value. Similarly, NaN (Not-a-Number) inputs are rejected. These validations ensure that the calculator only returns mathematically valid results and does not propagate IEEE 754 exceptional values into downstream computations.

References& sources.

  1. [1]NIST Digital Library of Mathematical Functions (2024). "Algebraic and Analytic Methods." §1.2. https://dlmf.nist.gov/1.2
  2. [2]Rudin, W. (1976). Principles of Mathematical Analysis, 3rd ed. McGraw-Hill. ISBN 978-0070542358.
  3. [3]Stewart, J. (2015). Calculus: Early Transcendentals, 8th ed. Cengage Learning. ISBN 978-1285741550.
  4. [4]Mangasarian, O.L. (2006). "Absolute value equations." Linear Algebra and its Applications 419(2-3): 359-367. doi:10.1016/j.laa.2006.05.004
  5. [5]Abbott, S. (2015). Understanding Analysis, 2nd ed. Springer. ISBN 978-1493927111.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 313 calculators remain free
  • No billing is enabled
Coming soon