Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

| x | =
5
distance from 0 on the number line
Input value (x) -5
Absolute value 5
Rule applied x < 0, so |x| = -x

What is absolute value?

The absolute value of a number, written \(|x|\), is its distance from zero on the number line. Distance is never negative, so the absolute value of any real number is always zero or positive. For example, both 5 and -5 sit five units away from 0, so \(|5| = 5\) and \(|-5| = 5\). This calculator works with any real number — positive, negative, whole, or decimal.

Number line showing distances from zero for a negative and positive value
Absolute value is the distance from 0 on the number line, so it is always non-negative.

How to use this calculator

Type a value into the "x =" box. You can enter a leading minus sign for negatives and a decimal point for fractions (for example -9.27). Use the result to read both the absolute value and the rule that was applied. Submit the form to compute \(|x| =\) instantly.

The formula explained

Absolute value is defined piecewise: \(|x| = x\) when \(x\) is greater than or equal to 0, and \(|x| = -x\) when \(x\) is less than 0. The second case flips the sign of a negative number, turning it positive.

$$|x| = \begin{cases} x & \text{if } x \ge 0 \\ -x & \text{if } x < 0 \end{cases}$$

An equivalent definition is \(|x| = \sqrt{x^2}\), since squaring removes the sign and the square root returns the magnitude. Either way, the output is never negative.

Advertisement
Diagram of the two-case absolute value rule
The piecewise rule: keep non-negative numbers, flip the sign of negatives.

Worked example

Suppose \(x = -5\). Because -5 is less than 0, we apply \(|x| = -x\), giving $$-(-5) = 5.$$ So the distance from 0 to -5 is 5 units. Likewise, \(|12.5| = 12.5\) and \(|0| = 0\). Zero is the single value whose absolute value is neither positive nor negative — it is simply 0.

FAQ

Can the result ever be negative? No. Absolute value measures distance, which is always 0 or greater.

What is the absolute value of 0? It is 0. Zero is neither positive nor negative, and its distance from itself is 0.

Does this handle complex numbers? No. This tool covers only real numbers. For a complex number \(a + bi\) the magnitude is \(\sqrt{a^2 + b^2}\), which is a different calculation.

Last updated: