Enter your number
Type any real number (like -12, 3.5, or 0). We’ll return |x| instantly. Turn on “Show steps” for the piecewise rule.
Enter any number (positive, negative, or decimal) and instantly get its absolute value (|x|). Turn on “show steps” to see the rule used.
Type any real number (like -12, 3.5, or 0). We’ll return |x| instantly. Turn on “Show steps” for the piecewise rule.
Absolute value is one of the simplest (and most useful) ideas in all of math. It answers a single question: How far is a number from zero? That distance is always non‑negative, which is why absolute value is never negative. You’ll see absolute value in algebra, geometry, statistics, finance, physics, and coding— anywhere you care about magnitude more than direction.
This calculator takes any real number (positive, negative, or zero) and returns its absolute value. If you enable “show steps”, it also explains exactly which rule was used and why.
The absolute value of a number x is written |x|. Conceptually, |x| is the distance from x to 0 on the number line. Because distance can’t be negative, |x| is always ≥ 0.
Absolute value is defined using a “piecewise” rule:
That’s it. The entire calculator is powered by this definition. When x is negative, multiplying by −1 makes it positive, turning “−7” into “7”.
Try it with your own values: type a number, hit Calculate, then change the sign and compare. It’s a fast way to build intuition.
If you want a “picture in your head”, imagine a number line: negative numbers are left of zero, positive numbers are right of zero. Absolute value ignores left/right and keeps only the distance. So −9 and +9 are equally far from zero, which is why |−9| = |9| = 9.
That same idea explains distance between two numbers: the distance from 2 to 11 is |2 − 11| = |−9| = 9. Distance from 11 to 2 is |11 − 2| = |9| = 9. No matter the order, distance is the same.
Internally the calculator does the same thing you would do by hand:
If you turn on “show steps”, you’ll also see which branch of the piecewise definition was used: either “x ≥ 0, so |x| = x” or “x < 0, so |x| = −x”.
For single numbers, yes: it removes the negative sign. But mathematically it’s better to think “distance from zero,” because that extends naturally to distance between two values (|a − b|) and to inequalities like |x| ≤ 3.
No. The smallest possible absolute value is 0 (only when x = 0). Otherwise it’s positive.
Start by rewriting |x| using its piecewise definition. Example: |x| = 5 means x = 5 or x = −5. For expressions like |x − 2| = 7, you set x − 2 = 7 or x − 2 = −7, then solve both.
Translate it into a “between” statement: |x| < 4 means x is within 4 units of 0, so −4 < x < 4. Similarly, |x| ≥ 4 means x is at least 4 units away: x ≤ −4 or x ≥ 4.
Yes. The same rules apply. Example: |−0.125| = 0.125 and |−3/7| = 3/7.
This calculator is for real numbers. For complex numbers, “absolute value” usually means magnitude, like |a + bi| = √(a² + b²). If you need that, a Complex Magnitude calculator is a good next tool to add to your Math category.
Double bars usually indicate a norm (length) in higher‑dimensional math. In one dimension, the norm behaves exactly like absolute value.
If you’re studying for a test, a quick practice trick is to generate a random number (positive or negative), compute |x|, then verify by checking your answer is always ≥ 0.
Absolute value has a few rules that show up constantly in simplification and proofs:
That last one, the triangle inequality, sounds fancy but it’s basically saying: if you walk 3 miles east and then 4 miles west, your final distance from the start can’t exceed 3 + 4 = 7 miles. Sometimes you end up closer.
If you graph y = |x|, you get a V‑shape with its point (vertex) at (0, 0). For x ≥ 0, the graph is just y = x (a line with slope 1). For x < 0, the graph is y = −x (a line with slope −1). The absolute value function “folds” the left side of the number line upward so everything becomes non‑negative.
This V‑shape is why absolute value shows up in optimization and “closest point” problems. Minimizing |x − a| means “pick x as close as possible to a.”
Example 1: |−18|
Example 2: |4.2|
Example 3: Distance between −3 and 10
If you want quick reps (great for students), try these:
A nice challenge is to invent your own: pick any number, change its sign, and confirm the absolute value stays the same.
A common homework pattern is something like |x − a| = b. This means: “x is b units away from a.” On a number line there are usually two points that are exactly b units away—one to the left and one to the right. So you solve it by creating two equations:
Example: |x − 5| = 3
So the solution set is {2, 8}.
Inequalities with absolute value come in two main flavors:
Example: |x + 1| ≤ 4
Example: |2x − 6| > 10
In code, absolute value is so common that nearly every language includes it: “abs(x)” in Python, JavaScript, and many others. It’s used for things like clamping values, measuring error, sorting by closeness, and comparing floats safely. A practical trick: if you’re comparing two decimal numbers that should be “the same” within a tolerance, you check if |a − b| ≤ tolerance. That’s how software handles tiny rounding differences.
If you like “viral math,” these quick “difference” examples are great for short-form posts: they feel like magic because absolute value makes the distance obvious.
It becomes positive. Example: |−8| = 8 because the distance from −8 to 0 is 8.
|0| = 0, because zero is zero units from zero.
No. Example: x = −3 → |x| = 3, but x² = 9.
Because distance is always non‑negative, and |a − b| measures how far apart a and b are on the number line.
Yes. You can use decimals, very large values, and negatives. If you want rounding, choose a decimal setting.
Try these next (picked from the Math category):
Use the Random Number Generator to produce a value, compute |x| here, then verify by checking your answer is never negative. Do 10 in a row and you’ll never miss an absolute value question again.