# What is the absolute value?

Computes the absolute value |x| of a number or fraction, the distance |a − b| between two numbers, or solves the absolute value equation |mx + n| = c, exactly.

- Page: https://www.acalculator.org/math/absolute-value-calculator
- JSON spec: https://www.acalculator.org/math/absolute-value-calculator.json
- Version: 199d03659ee9

## Default answer

Example with the default inputs (Find |x|, Number x -7): |-7| = 7.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| mode | Find | What to work out: the absolute value of one number, the distance between two, or an equation. |
| x | Number x | The number to take the absolute value of: a whole number, decimal or fraction. |
| a | Number a | The first number. |
| b | Number b | The second number. |
| m | m | The number that multiplies x inside the bars. |
| n | n | The number added to m·x inside the bars. |
| c | c | The number on the right of the equals sign. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| result | Answer | The absolute value, the distance, or the solutions for x, as exact fractions (a mixed number above 1). |
| decimal | As a decimal | The absolute value or the distance as a decimal. |
| statement | Working | The answer written out, for example \|−7\| = 7 or x = 2 or x = −1. |
| count | Number of solutions | How many values of x solve the equation: 0, 1, 2, or every number. |

## Method

|x| = x if x ≥ 0, −x if x < 0; distance = |a − b|; |mx + n| = c gives x = (c − n) ÷ m or x = (−c − n) ÷ m.

## Assumptions

- Inputs are exact: whole numbers, decimals, fractions such as 3/4, or mixed numbers such as 1 1/2.
- Answers are exact fractions in lowest terms.

## Worked examples

1. mode = value, x = -7 gives result = 7, decimal = 7, statement = |-7| = 7. Source: OpenStax Algebra and Trigonometry 2e, section 2.6, Other Types of Equations: if x < 0, |x| = −x (https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-6-other-types-of-equations, retrieved 2026-10-01).
2. mode = value, x = -3/4 gives result = 3/4, decimal = 0.75.
3. mode = distance, a = 3, b = 10 gives result = 7, statement = |3 − 10| = 7.
4. mode = equation, m = 2, n = -1, c = 3 gives statement = x = -1 or x = 2, count = 2. Source: OpenStax Algebra and Trigonometry 2e, section 2.6, Other Types of Equations: |2x − 1| = 3 gives x = 2 and x = −1 (https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-6-other-types-of-equations).
5. mode = equation, m = 3, n = 6, c = 0 gives result = -2, count = 1.

## FAQ

### What is an absolute value?

The distance of a number from 0 on the number line, so it is never negative. If x is 0 or more, |x| = x; if x is below 0, |x| = −x. So |−7| = 7 and |7| = 7.

### How do I find the absolute value of a fraction?

Drop the minus sign: |−3/4| = 3/4. Type the fraction as 3/4, −3/4 or a mixed number such as 1 1/2.

### How do I find the distance between two numbers?

Subtract them and take the absolute value: |a − b|. The distance between 3 and 10 is |3 − 10| = |−7| = 7, the same as |10 − 3|.

### How do I solve an absolute value equation?

For |mx + n| = c with c above 0, solve the two equations mx + n = c and mx + n = −c. For |2x − 1| = 3: 2x − 1 = 3 gives x = 2, and 2x − 1 = −3 gives x = −1.

### When does an absolute value equation have no solution?

When the right side c is negative, because an absolute value is never below 0. |x + 4| = −2 has no solution. When c is 0 there is exactly one solution.

### What happens when m is 0?

Then the left side is |n| for every x. If |n| equals c, every number is a solution; otherwise none is.

## Sources

- OpenStax, Algebra and Trigonometry 2e, section 2.6, Other Types of Equations (definition of absolute value; |ax + b| = c has no solution for c < 0, one for c = 0, two for c > 0; example |2x − 1| = 3), CC BY 4.0, retrieved 2026-10-01. https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-6-other-types-of-equations
