Absolute Value Calculator
How far is any number from zero on the number line?
Enter any real number — positive, negative, or zero — and get its absolute value immediately. The result shows the distance from zero on the number line, along with which branch of the piecewise definition was applied.
—
Send feedback
💡 Share your idea or report a problem
✓ Thanks! We'll take a look.
Learn more
How It Works
The formula, explained simply
Picture a number line stretched out in both directions from a central zero. The absolute value of any number is simply how far that point sits from zero — measured in steps, with no regard for which direction you walked to get there. Walk fifteen steps left and you are fifteen units from zero. Walk fifteen steps right and you are also fifteen units from zero. The direction vanishes; only the distance survives.
That intuition is captured exactly by the piecewise definition. For non-negative inputs, nothing changes: the number is already at a non-negative distance from zero. For negative inputs, the sign is flipped by negating the value, converting the directed position into a pure distance. Two simple rules, covering every real number without exception.
The notation |x| is a compact way of writing this operation. You will see it in geometry when computing lengths, in algebra when solving equations with two symmetric solutions, in calculus when defining norms and metrics, and in physics when reporting magnitudes. Every use case reduces to the same question: how far is this quantity from zero?
When To Use This
Right tool, right situation
Use an absolute value calculation whenever you care about magnitude rather than direction. Typical situations include computing distances between two points on a number line (subtract one from the other, then take the absolute value), measuring the size of an error or deviation regardless of sign, and simplifying expressions that appear under a square root where the radicand must be non-negative.
Absolute value is also the right tool when solving equations or inequalities of the form |x - a| = b or |x| ≤ c, because the solution always splits into two cases that correspond to the two branches of the definition. In these settings the tool gives you the numeric magnitude you need for each case.
This calculator is not appropriate for complex numbers, vectors, or matrices. For a complex number the correct quantity is the modulus; for a vector it is the Euclidean norm; for a matrix it is a matrix norm. All of these reduce to absolute value only in the special case of a single real number. If your quantity has more than one component, use the appropriate multi-dimensional tool instead.
Common Mistakes
Why results sometimes look wrong
Mistake 1 — Thinking absolute value always removes the minus sign by discarding it. The mechanism is negation, not deletion. For a negative input x, |x| = -x means you are computing the negative of a negative, which gives a positive. Simply dropping the sign character without understanding the arithmetic can cause errors when x appears in a larger expression: substituting |x| = -x into a formula still requires carrying out that negation correctly.
Mistake 2 — Solving |x| = c with only one solution. Because both x = c and x = -c satisfy the equation when c is positive, ignoring the negative solution is a common error in algebra. The absolute value definition guarantees that two inputs map to the same output whenever the inputs are negatives of each other. Always check both branches when the equation is set equal to a specific value.
Mistake 3 — Applying absolute value to complex numbers as if they were real. This calculator covers real numbers only. For a complex number a + bi, the modulus (also called absolute value) is computed as the square root of a squared plus b squared — a different formula that produces a real result from a two-dimensional input. Using the real-number definition on a complex number gives the wrong answer or breaks down entirely.
The Math
Worked examples and deeper derivation
The absolute value function is defined piecewise. For any real number x: if x is greater than or equal to zero, |x| = x; if x is negative, |x| = -x. Both branches produce a non-negative result, and together they cover all real numbers.
For the example input of -15, x is negative so the second branch applies: |-15| = -(-15) = 15. The double negative resolves to a positive. For a positive input the first branch applies and the value passes through unchanged.
Four algebraic properties follow directly from the definition. First, |x| is always greater than or equal to zero. Second, |x| = |-x|, confirming the mirror symmetry. Third, the product rule: |xy| = |x||y|. Fourth, the quotient rule: |x/y| = |x|/|y| whenever y is nonzero. The triangle inequality — |x + y| ≤ |x| + |y| — is a fifth property with deep consequences in analysis and geometry.
Expert Unlock
The thing most explanations skip
The piecewise definition treats the real line as two half-lines joined at zero, which means the function has a corner — a point of non-differentiability — at the origin. This matters in optimisation: a function involving |x| is convex everywhere but not smooth at zero, which is why subgradient methods rather than standard gradients are needed there. In machine learning, the L1 loss (mean absolute error) inherits exactly this geometry, producing sparse solutions where gradient descent on a smooth loss would not.
What does the absolute value of a number actually mean?
Need something this doesn't cover?
Suggest a tool — we'll build it →