Skip to main content

Absolute Value Calculator

Enter any number x to get |x|, with step-by-step working and a number line.

Number line: x and |x|

● x   ● |x|   ▮ distance from 0

Piecewise definition

The absolute value is defined in two pieces:

  • If x ≥ 0, then |x| = x (the number stays as it is).
  • If x < 0, then |x| = -x (negate it to make it positive).

Intuition: |x| is the distance from x to 0 on the number line, and distances are never negative.

Worked examples

InputBranch usedWorkingResult
-7x < 0|x| = -x = -(-7)7
4.25x ≥ 0|x| = x4.25
-0.5x < 0|x| = -x = -(-0.5)0.5
0x ≥ 0|x| = x0
-12.8x < 0|x| = -x = -(-12.8)12.8

Properties of absolute value

PropertyExample (verified)
Non-negativity: |x| ≥ 0 for every x|-12.8| = 12.8 ≥ 0
Symmetry: |-x| = |x||-4.25| = |4.25| = 4.25
Multiplicative: |a × b| = |a| × |b||-3 × 4| = |-12| = 12 = 3 × 4
Triangle inequality: |a + b| is at most |a| + |b||-5 + 2| = |-3| = 3, and 3 ≤ 7 = 5 + 2
Square root: √(x²) = |x|√((-7)²) = √49 = 7
Boundary note: this tool computes |x| for a single number (its distance from 0). The distance between two numbers, |a - b|, is a different calculation (absolute difference). For a percentage comparison of two numbers, see percent difference calculator.

Frequently asked questions

What is the absolute value of a number?

The absolute value of a number is its distance from 0 on the number line, so it is never negative. Both -7 and 7 sit 7 units from 0, so |-7| = 7 and |7| = 7.

How do you calculate absolute value?

Use the piecewise definition: if x is zero or positive, |x| = x; if x is negative, |x| = -x. So |4.25| = 4.25, while |-12.8| = -(-12.8) = 12.8.

What is the absolute value of -7?

7. Because -7 is negative, apply |x| = -x: -(-7) = 7. On the number line, -7 is 7 units to the left of 0.

What is the absolute value of 0?

0. Zero is neither positive nor negative, and it is 0 units from itself, so |0| = 0.

Can an absolute value be negative?

No. By definition |x| is never below 0 for any real x. When x is negative, the minus sign in |x| = -x flips it positive, for example |-4.25| = 4.25.

What is the difference between absolute value and absolute difference?

Absolute value takes one number: |x| is its distance from 0, for example |-7| = 7. Absolute difference takes two numbers: |a - b| is the distance between them. This calculator handles single-number absolute value only.

What are the main properties of absolute value?

Four matter most: |x| is never negative; |-x| = |x|; |a x b| = |a| x |b|, for example |-3 x 4| = |-12| = 12 = 3 x 4; and the triangle inequality, where |a + b| is less than or equal to |a| + |b|, for example |-5 + 2| = 3 which is less than 7 = |-5| + |2|. Also, the square root of x squared equals |x|.

What is the absolute value of -0.5?

0.5. Since -0.5 is negative, negate it: -(-0.5) = 0.5.

Free tool by NRTechStudio