Absolute Value Calculator

Calculate the absolute value (magnitude) of any real number. Also called **modulus**, absolute value represents the distance from zero on the number line.

Single Number

Expression

Equation

Inequality

Result
Enter a value and click calculate

Quick Examples

Introduction to Absolute Value

When engineers measure manufacturing tolerance, statisticians compute prediction error, physicists distinguish speed from velocity, or programmers calculate distances, they all encounter the same mathematical concept: absolute value. Despite its simple definition, absolute value appears across every quantitative discipline.

An absolute value calculator instantly computes the magnitude of any number, expression, or solves equations and inequalities containing absolute value bars. The concept is also called modulus in physics and engineering contexts, but both terms mean exactly the same thing: the distance of a number from zero.

Students learning algebra, engineers calculating error tolerances, programmers implementing distance functions, physicists analyzing motion, statisticians measuring deviation, and data scientists evaluating model accuracy all rely on absolute value. This page covers four major applications: finding absolute value of single numbers, evaluating expressions inside absolute value bars, solving absolute value equations, and solving absolute value inequalities with full worked examples for each.

What is Absolute Value?

Absolute value is the distance of a number from zero on the number line, regardless of direction. Because distance is never negative, absolute value always returns zero or a positive number.

Formal mathematical definition:

|x| = x, if x >= 0
|x| = -x, if x < 0

This is called a piecewise definition — the formula changes based on whether x is non-negative or negative.

Visual Explanation

On a number line, |5| = 5 because 5 is 5 units to the right of zero. |-5| = 5 because -5 is 5 units to the left of zero. Both numbers are equally distant from zero, just in opposite directions.

  • |5| = 5 — five is 5 units from zero
  • |-5| = 5 — negative five is also 5 units from zero
  • |0| = 0 — zero is zero distance from itself

Key Insight

Absolute value strips the sign of a number. The result is always zero or positive — never negative.

Special Cases

  • |0| = 0: Zero is zero distance from itself.
  • |positive| = same positive: |7| = 7.
  • |negative| = positive version: |-12| = 12.

Absolute Value vs. Opposite of a Number

These are different concepts. Absolute value removes the sign: |-7| = 7. The opposite flips the sign: -(-7) = 7. For negative inputs, both give the same result. But for positive inputs: |7| = 7 (absolute value) versus -7 = -7 (opposite). They differ fundamentally.

How Does the Absolute Value Calculator Work?

This calculator accepts various input types and handles each appropriately.

Input Types

  • Single number: Returns the non-negative magnitude.
  • Expression: Evaluates inside the bars first, then applies absolute value.
  • Equation: Solves for unknown variable(s) in equations like |x-3| = 7.
  • Inequality: Finds solution set for inequalities like |x| < 5.

How It Handles Different Inputs

Input TypeExampleProcessOutput
Positive integer|12|Returns same12
Negative integer|-15|Removes minus15
Zero|0|Base case0
Decimal|-3.75|Removes minus3.75
Fraction|-7/8|Removes minus7/8
Expression|3-8|Evaluate: 3-8=-5, then |-5|=55
Complex|3+4i|sqrt(9+16)5

Absolute Value Formula Explained

Piecewise Definition

The standard formal definition:

|x| = x, when x >= 0
|x| = -x, when x < 0

When x is non-negative, its absolute value is itself. When x is negative, its absolute value is its opposite (which becomes positive).

Alternative Formula Using Square Root

|x| = sqrt(x^2)

This formula always produces a non-negative result because squaring eliminates any sign, and the square root returns the non-negative root. For example: sqrt((-5)^2) = sqrt(25) = 5.

Distance Interpretation

|a - b| = distance between points a and b

Example: |3 - 8| = |-5| = 5. The points 3 and 8 are 5 units apart on the number line.

Worked Examples

ExpressionWorkingResult
|7|Positive, so |7| = 77
|-12|Negative, so |-12| = -(-12) = 1212
|0|Special case: zero distance from zero0
|-3.5|Remove sign from decimal3.5
|-3/4|Remove sign from fraction3/4
|5 - 11|First evaluate: 5 - 11 = -6, then |-6| = 66

Properties of Absolute Value

These properties are fundamental to algebra, calculus, and analysis.

Non-negativity

|x| >= 0 for all x; |x| = 0 only when x = 0

Example: |-100| = 100 >= 0. Verified.

Identity

|x| = x when x >= 0

Example: |9| = 9. For non-negative numbers, absolute value returns the same number.

Negation (Symmetry)

|-x| = |x|

Example: |-7| = 7 = |7|. The absolute value of a number and its opposite are equal.

Multiplicative Property

|x * y| = |x| * |y|

Example: |-3 * 4| = |-12| = 12 = |-3| * |4| = 3 * 4 = 12. Verified.

Division Property

|x / y| = |x| / |y| (when y != 0)

Example: |-15 / 3| = |-5| = 5 = |-15| / |3| = 15 / 3 = 5. Verified.

Power Property

|x^n| = |x|^n for integer n

Example: |(-3)^2| = |9| = 9 = |-3|^2 = 3^2 = 9. Verified.

Triangle Inequality

|x + y| <= |x| + |y|

Example: |3 + (-7)| = |-4| = 4 <= |3| + |-7| = 3 + 7 = 10. Verified.

This is profound: the direct path is never longer than going through an intermediate point. Fundamental to geometry, vector mathematics, and analysis.

Reverse Triangle Inequality

||x| - |y|| <= |x - y|

The difference in magnitudes is bounded by the magnitude of the difference.

Properties Reference Table

PropertyFormulaExample
Non-negativity|x| >= 0|-5| = 5 >= 0
Identity|x| = x if x >= 0|8| = 8
Symmetry|-x| = |x||-7| = |7| = 7
Multiplicative|xy| = |x||y||-2*5| = 10 = 2*5
Division|x/y| = |x|/|y||-12/4| = 3 = 12/4
Triangle|x+y| <= |x|+|y||2+(-5)| = 3 <= 7

Absolute Value of Expressions

Definition

Evaluate the expression inside the absolute value bars first, then apply absolute value to the result. The bars act as grouping symbols — always simplify everything inside before applying absolute value.

Rules

  1. Simplify everything inside |...| completely.
  2. Apply absolute value to the final result.
  3. Do NOT apply absolute value to individual terms before simplifying.

Worked Examples

Example 1: |3 - 8|

  • First: evaluate 3 - 8 = -5
  • Then: |-5| = 5
  • Result: 5
  • NOT |3| - |8| = 3 - 8 = -5 (wrong method)

Example 2: |2^2 - 10|

  • First: 2^2 = 4, so 4 - 10 = -6
  • Then: |-6| = 6
  • Result: 6

Example 3: |-4 * (3 - 5)|

  • First: 3 - 5 = -2
  • Then: -4 * (-2) = 8
  • Then: |8| = 8
  • Result: 8

Example 4: |(-3)^2 + (-4)^2|

  • First: (-3)^2 = 9, (-4)^2 = 16
  • Then: 9 + 16 = 25
  • Then: |25| = 25
  • Result: 25

Critical Warning

|a + b| does NOT equal |a| + |b| in general. They're equal only when a and b have the same sign. |a - b| does NOT equal |a| - |b|. Always evaluate the full expression inside bars before applying absolute value.

Absolute Value Equations

Definition

Equations containing absolute value expressions with an unknown variable require special handling because one absolute value can correspond to two different numbers.

Key Principle

  • |x| = a (where a > 0): TWO solutions: x = a OR x = -a
  • |x| = 0: ONE solution: x = 0
  • |x| = negative: NO solution (impossible)

Step-by-Step Process

  1. Isolate the absolute value expression on one side.
  2. Check if the other side is negative — if so, no solution exists.
  3. Split into two cases: expression = +value AND expression = -value.
  4. Solve each case separately.
  5. Verify both solutions by substituting back into the original equation.

Worked Examples

Basic: |x| = 5

  • Two solutions: x = 5 or x = -5

Linear: |x - 3| = 7

  • Case 1: x - 3 = 7, so x = 10
  • Case 2: x - 3 = -7, so x = -4
  • Solutions: x = 10 or x = -4
  • Verify: |10 - 3| = |7| = 7 ✓ and |-4 - 3| = |-7| = 7 ✓

With coefficient: |2x + 1| = 9

  • Case 1: 2x + 1 = 9, so 2x = 8, x = 4
  • Case 2: 2x + 1 = -9, so 2x = -10, x = -5
  • Solutions: x = 4 or x = -5

No solution: |x + 3| = -2

  • Absolute value cannot equal a negative number.
  • No solution exists.

One solution: |3x - 6| = 0

  • Only zero has absolute value zero.
  • 3x - 6 = 0, so x = 2
  • Single solution: x = 2

Both sides absolute: |2x - 1| = |x + 4|

  • Case 1: 2x - 1 = x + 4, so x = 5
  • Case 2: 2x - 1 = -(x + 4), so 2x - 1 = -x - 4, thus 3x = -3, x = -1
  • Solutions: x = 5 or x = -1

Extraneous Solutions Warning

Always substitute answers back into the original equation. Some algebraic manipulations can introduce false solutions that don't actually work.

Absolute Value Inequalities

Definition

Inequalities containing absolute value expressions have two fundamental types with opposite solution behaviors.

Type A: Less Than (|x| < a)

|x| < a means -a < x < a

This is an AND condition. "Within a distance of a from zero."

Example: |x| < 4 means -4 < x < 4. Solution is the bounded interval (-4, 4).

Example: |x - 2| < 5 means -5 < x - 2 < 5, so -3 < x < 7.

Type B: Greater Than (|x| > a)

|x| > a means x < -a OR x > a

This is an OR condition. "Outside a distance of a from zero."

Example: |x| > 3 means x < -3 or x > 3. Solution is two separate rays.

Example: |x + 1| > 4 means x + 1 < -4 or x + 1 > 4, so x < -5 or x > 3.

Worked Examples

Less than or equal: |x - 3| <= 7

  • -7 <= x - 3 <= 7
  • Add 3: -4 <= x <= 10
  • Solution: [-4, 10] (closed interval)

Strictly less than: |2x + 4| < 8

  • -8 < 2x + 4 < 8
  • Subtract 4: -12 < 2x < 4
  • Divide by 2: -6 < x < 2
  • Solution: (-6, 2)

Greater than: |x - 5| > 2

  • x - 5 < -2 or x - 5 > 2
  • x < 3 or x > 7
  • Solution: Two rays (-inf, 3) U (7, inf)

Greater or equal: |3x - 1| >= 5

  • 3x - 1 <= -5 or 3x - 1 >= 5
  • 3x <= -4 or 3x >= 6
  • x <= -4/3 or x >= 2

No solution case: |x + 2| < -1

  • Absolute value cannot be less than a negative number.
  • No solution.

All real numbers: |x - 3| > -2

  • Absolute value is always non-negative, so always > -2.
  • Solution: All real numbers.

Memory Trick

Less than = "lEss thAn" = AND = between (bounded interval).

Greater than = "grEATer" = OR = outside (two rays).

Absolute Value on the Number Line

The geometric interpretation makes absolute value intuitive:

  • |x| = distance from x to 0
  • |x - a| = distance from x to point a
  • |x - a| < r = all points within distance r of a (bounded interval)
  • |x - a| > r = all points more than distance r from a (two rays)

Example: |x - 5| < 3 means all points within 3 units of 5 on the number line: (2, 8).

Absolute Value in Coordinate Geometry

Distance Between Points

On a number line, distance between two points: d = |x2 - x1|.

Example: Distance between -3 and 7 is |7 - (-3)| = |10| = 10.

Manhattan Distance (Taxicab Geometry)

d = |x2 - x1| + |y2 - y1|

Used in grid-based city navigation — the distance traveling along city blocks rather than straight-line distance.

Graph of y = |x|

The absolute value function produces a V-shaped graph with vertex at the origin:

  • Right side (x >= 0): y = x (line with slope 1)
  • Left side (x < 0): y = -x (line with slope -1)
  • Vertex at (0, 0)

Transformations: y = |x - h| + k shifts the vertex to (h, k).

Example: y = |x - 3| + 2 has vertex at (3, 2).

Absolute Value in Complex Numbers

For complex number z = a + bi, the absolute value (also called modulus) is:

|z| = sqrt(a^2 + b^2)

This represents the distance from origin to point (a, b) in the complex plane.

Examples

  • |3 + 4i| = sqrt(9 + 16) = sqrt(25) = 5
  • |-5 + 12i| = sqrt(25 + 144) = sqrt(169) = 13
  • |-2 - 3i| = sqrt(4 + 9) = sqrt(13) = 3.606...

Why It Matters

The modulus connects to the Pythagorean theorem — it's the hypotenuse of the right triangle formed by real and imaginary parts. In electrical engineering, modulus represents impedance magnitude in AC circuits.

Real-Life Use Cases

Error and Tolerance in Engineering

Absolute error = |measured - actual|. Manufacturing tolerances expressed as +-x use absolute value to specify acceptable deviation in either direction from a target dimension.

Statistics and Data Science

Mean Absolute Error (MAE) averages |predicted - actual| across all predictions. Absolute deviation from the mean is a robust measure of spread less sensitive to outliers than squared deviation.

Physics — Displacement vs. Distance

Distance traveled is always positive, represented by absolute value of displacement. Speed = |velocity| — speed is always non-negative regardless of velocity's sign.

Finance and Economics

Profit/loss magnitude = |revenue - cost|. Absolute return = |ending value - starting value|. Risk models use absolute deviation from expected return as a risk measure.

Computer Science and Programming

Absolute value functions appear in sorting algorithms, distance calculations, error checking, bounds testing, and hash functions. Any comparison of magnitudes requires absolute value.

GPS and Navigation

Deviation from planned route = |actual position - planned position|. Manhattan distance in grid navigation uses |delta_x| + |delta_y| for city-block routing.

Temperature Differences

Temperature change = |T2 - T1| regardless of whether warming or cooling occurred. The magnitude of change matters, not the direction.

Signal Processing

Amplitude of a wave at any point equals absolute value of the signal function. Audio processing, image processing, and telecommunications all rely on amplitude calculations.

Absolute Value in Programming

LanguageFunctionExampleNotes
Pythonabs(x)abs(-7) = 7Works for int, float, complex
JavaScriptMath.abs(x)Math.abs(-12) = 12Returns 0 for null/undefined
JavaMath.abs(x)Math.abs(-5) = 5Overloaded for all numeric types
C++std::abs(x)std::abs(-3) = 3Use for floats
Excel=ABS(number)=ABS(-10) returns 10Simple worksheet function
SQLABS(column)ABS(-5) = 5Works in all major databases
NumPynp.abs(array)Element-wiseArray operations

Edge Case Warning

In Java, Math.abs(Integer.MIN_VALUE) returns a negative number due to integer overflow. The minimum 32-bit integer (-2147483648) has no positive counterpart in signed representation.

Absolute Value vs. Related Concepts

ConceptSymbolDefinitionFor -5For 5
Absolute Value|x|Distance from zero55
Opposite/Negation-xFlip sign5-5
Sign Functionsgn(x)Returns -1, 0, or 1-11
Root of Squaresqrt(x^2)Non-negative root55
Floor Functionfloor(x)Round down-55

Key distinction: Absolute value is NOT the same as opposite or negation. They give different results for positive inputs.

Key Concepts and Glossary

  • Absolute value: The non-negative distance of a number from zero, denoted |x|.
  • Modulus: Another term for absolute value, especially for complex numbers or in physics/engineering.
  • Number line: Visual representation of real numbers as points on a line.
  • Distance: The absolute difference between two values on a number line.
  • Piecewise function: A function defined by different formulas for different input ranges.
  • Triangle inequality: |x + y| <= |x| + |y|, fundamental in analysis.
  • Absolute error: |measured - actual|, magnitude of measurement error.
  • Mean Absolute Error (MAE): Average of absolute prediction errors in statistics.
  • Solution set: All values satisfying an equation or inequality.
  • Bounded interval: An interval with finite endpoints (both ends limited).
  • Unbounded interval: An interval extending to infinity in at least one direction.

Tips and Best Practices

  • Evaluate inside first: Always simplify the expression inside |...| before applying absolute value.
  • Two solutions: |x| = a has two solutions (for a > 0), one (for a = 0), or none (for a < 0).
  • Inequality direction: "Less than" means AND (between); "Greater than" means OR (outside).
  • Verify solutions: Always substitute back into the original equation.
  • Integer overflow: Watch for abs(MIN_VALUE) overflow in programming.
  • Complex numbers: Use modulus formula sqrt(a^2 + b^2), not standard absolute value.

Common Mistakes to Avoid

  • |a + b| = |a| + |b|: Only true when a and b have the same sign.
  • |a - b| = |a| - |b|: Almost never true. Don't distribute absolute value.
  • Missing negative case: Absolute value equations have two solutions; don't forget x = -a.
  • Unverified solutions: Always check for extraneous solutions after solving.
  • Wrong inequality direction: |x| < a is AND; |x| > a is OR. Don't confuse them.
  • Premature absolute value: Evaluate inside bars first, then apply absolute value.
  • Confusing notation: |x| (absolute value) vs. |A| (determinant of matrix A) — different concepts.

Frequently Asked Questions

What is absolute value in math?
Absolute value is the distance of a number from zero on the number line, always expressed as a non-negative value. Written as |x| with vertical bars, it represents magnitude without regard to sign. For example, |5| = 5 and |-5| = 5 because both numbers are equally distant from zero, just in opposite directions.
What is |0|?
|0| = 0. The absolute value of zero is zero because zero is exactly zero distance from itself on the number line. This is the only case where absolute value equals zero; every other real number has a positive absolute value.
Can absolute value ever be negative?
No, absolute value can never be negative. By definition, absolute value represents distance, which is always zero or positive. If you encounter an equation like |x| = -3, it has no solution because no real number's magnitude can be negative.
What is the difference between absolute value and opposite of a number?
Absolute value |x| returns the non-negative magnitude regardless of input sign. The opposite -x flips the sign. For negative inputs like -7, both give 7: |-7| = 7 and -(-7) = 7. But for positive 7, |7| = 7 while -7 = -7. They're fundamentally different operations.
How do you solve an absolute value equation?
First isolate the absolute value on one side. Then split into two cases: the expression inside equals the positive value AND equals the negative value. Solve each separately. For |x-3| = 7, solve x-3 = 7 giving x = 10, and x-3 = -7 giving x = -4. Always verify solutions by substituting back.
Why does |x| = a have two solutions?
Because two different numbers have the same absolute value: one positive and one negative. Both 5 and -5 are 5 units from zero, so |x| = 5 is satisfied by x = 5 OR x = -5. The absolute value function maps two different inputs to the same output, requiring two cases when solving.
What does |x| < a mean as an inequality?
|x| < a means x is within distance a from zero, expressed as -a < x < a. This is an AND condition (x is between negative a and positive a). For |x| < 4, the solution is -4 < x < 4, a bounded interval centered at zero.
What does |x| > a mean as an inequality?
|x| > a means x is more than distance a from zero, expressed as x < -a OR x > a. This is an OR condition (x is outside the range between negative a and positive a). For |x| > 3, the solution is x < -3 or x > 3, two separate unbounded rays.
What is the absolute value of a complex number?
For complex number z = a + bi, the absolute value (modulus) is |z| = sqrt(a^2 + b^2). This represents the distance from origin (0,0) to point (a,b) in the complex plane. For example, |3 + 4i| = sqrt(9 + 16) = sqrt(25) = 5, the hypotenuse of a right triangle.
How is absolute value used in real life?
Absolute value appears in error calculations (|measured - actual|), distance problems, physics (speed = |velocity|), finance (absolute returns), statistics (mean absolute error), GPS routing, temperature change magnitude, signal amplitude, and programming distance functions. Any measurement of magnitude or deviation uses absolute value.
What is the triangle inequality for absolute values?
The triangle inequality states |x + y| <= |x| + |y|. Geometrically, the direct distance between two points is never longer than the sum of distances through an intermediate point. For example, |3 + (-7)| = |-4| = 4, which is less than |3| + |-7| = 10.
How do you graph y = |x|?
The graph is V-shaped with vertex at the origin. For x >= 0, y = x (rising diagonal line). For x < 0, y = -x (rising diagonal line extending left). The vertex shifts to (h, k) with y = |x-h| + k. Transformations shift, stretch, or flip the V-shape.
How is absolute value calculated in programming?
Python uses abs(x), JavaScript uses Math.abs(x), Java has Math.abs(x), C++ has std::abs(x) in , Excel uses =ABS(number), and SQL uses ABS(column). All return the non-negative magnitude. Python's abs() even handles complex numbers, returning the modulus sqrt(a^2 + b^2).
What is Mean Absolute Error and how does it use absolute value?
Mean Absolute Error (MAE) = average of |predicted - actual| values across all predictions. It measures prediction accuracy by averaging the magnitude of errors. Unlike Mean Squared Error, MAE treats all errors proportionally rather than penalizing outliers more heavily, making it a robust metric.

Historical Context

Ancient Greek mathematics developed the concept of magnitude as always positive — lengths, areas, and distances had no sign, only size.

Jean-Robert Argand (1806) introduced the concept of modulus for complex numbers, visualizing them in the complex plane with magnitude.

Karl Weierstrass introduced the vertical bar notation |x| in 1841, standardizing the symbol used today.

19th century mathematicians formalized absolute value in real analysis, metric spaces, and field theory, connecting it to distance and convergence.

Modern computing includes abs() in every programming language since FORTRAN (1957), making absolute value one of the most basic and universal mathematical operations in software.

Related Calculators

These tools extend absolute value concepts:

  • Distance Calculator: Compute distances using absolute difference.
  • Inequality Calculator: Solve various types of inequalities.
  • Complex Number Calculator: Operations including modulus calculation.
  • Mean Calculator: Use with absolute deviation for MAE.
  • Standard Deviation Calculator: Compare with absolute deviation measures.
  • Equation Solver: Solve algebraic equations of all types.

Conclusion

Absolute value is a deceptively simple yet profoundly important concept spanning all branches of mathematics. This page covered four major applications: finding absolute value of single numbers (distance from zero), evaluating expressions inside bars (simplify first), solving absolute value equations (two cases for each isolated absolute value), and solving inequalities (less-than means AND, greater-than means OR).

From geometry (distance between points) to algebra (equations and inequalities), from statistics (mean absolute error) to physics (speed from velocity), from programming (abs function) to complex analysis (modulus), absolute value appears wherever magnitude matters regardless of sign.

Use the absolute value calculator above for instant, accurate results. Whether computing simple magnitudes, solving complex equations, or analyzing inequalities, this tool provides step-by-step solutions for learning and verification.