# How does fraction to decimal work?

Converts a fraction or mixed number to its exact decimal, with the repeating digits marked, a rounded value, the percent, and the long division.

- Page: https://www.acalculator.org/math/fraction-to-decimal
- JSON spec: https://www.acalculator.org/math/fraction-to-decimal.json
- Version: 02ef73cc90db

## Default answer

Example with the default inputs (Fraction 5/8, Round to (decimal places) 4): 5/8 as a decimal is 0.625.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| f | Fraction | A fraction, mixed number, or whole number, such as 5/8, 1 3/4, or -2/3. |
| dp | Round to (decimal places) | How many decimal places the rounded value keeps, from 0 to 20. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| decimal | Decimal | The exact decimal: every digit when it ends, or the repeating digits marked with a bar (0.16̅ is 0.1666…). |
| rounded | Rounded | The decimal rounded to the chosen number of decimal places; halves round away from zero. |
| percent | As a percent | The fraction times 100, exact, with the same bar for repeating digits. |
| kind | Type of decimal | Terminating when the digits end, repeating when a block of digits repeats forever. |
| period | Repeating digits | How many digits the repeating block has, when it is found within 60 decimal places. |
| fractionText | Fraction in lowest terms | The fraction as an improper fraction in lowest terms, numerator/denominator. |
| steps | Long division | The long division of the numerator by the denominator, one digit at a time. |

## Method

Divide the numerator by the denominator by long division: each step multiplies the remainder by 10 and divides again; the decimal ends when a remainder is 0 and repeats from the first remainder that comes up twice.

## Assumptions

- The arithmetic is exact, with whole numbers of any size.
- A repeating block is marked with a bar over each of its digits (0.16̅ = 0.1666…). If no block repeats within 60 decimal places, the first 60 are shown, then "…".
- The rounded value keeps exactly the chosen number of decimal places; halves round away from zero (0.125 to 2 places is 0.13).

## Worked examples

1. f = 5/8, dp = 4 gives decimal = 0.625, rounded = 0.6250, percent = 62.5%, kind = terminating, period = 0, steps = 5 ÷ 8 = 0 remainder 5; 50 ÷ 8 = 6 remainder 2; 20 ÷ 8 = 2 remainder 4; 40 ÷ 8 = 5 remainder 0; The remainder is 0, so the decimal ends; 5/8 = 0.625. Source: Method from OpenStax Prealgebra 2e, section 5.3: https://openstax.org/books/prealgebra-2e/pages/5-3-decimals-and-fractions.
2. f = 1/3, dp = 4 gives decimal = 0.3̅, rounded = 0.3333, percent = 33.3̅%, kind = repeating, period = 1.
3. f = 1/6, dp = 2 gives decimal = 0.16̅, rounded = 0.17, period = 1.
4. f = 1/7, dp = 3 gives decimal = 0.1̅4̅2̅8̅5̅7̅, rounded = 0.143, period = 6.
5. f = 1 3/4, dp = 1 gives decimal = 1.75, rounded = 1.8, fractionText = 7/4, percent = 175%.
6. f = -2/3, dp = 4 gives decimal = -0.6̅, rounded = -0.6667.
7. f = 1/97 gives decimal = 0.010309278350515463917525773195876288659793814432989690721649…, kind = repeating.

## FAQ

### How do I convert a fraction to a decimal?

Divide the numerator (top) by the denominator (bottom). 5/8 = 5 ÷ 8 = 0.625. By hand, use long division: 8 goes into 5 zero times, then into 50 six times (remainder 2), into 20 twice (remainder 4), and into 40 five times (remainder 0), which gives 0.625.

### Why do some fractions give repeating decimals?

In long division there are only as many possible remainders as the denominator, so if the remainder never reaches 0, a remainder must come back, and from then on the same digits repeat. 1/3 gives remainder 1 at every step, so 1/3 = 0.333… .

### Which fractions give decimals that end?

A fraction in lowest terms gives a terminating decimal exactly when its denominator has no prime factors other than 2 and 5. 3/8, 7/20 and 9/125 end; 1/3, 5/6 and 2/7 repeat.

### What does the bar over the digits mean?

The bar marks the digits that repeat forever. 0.16̅ means 0.16666…, where only the 6 repeats, and 0.1̅4̅2̅8̅5̅7̅ means 0.142857142857… .

### How do I convert a mixed number to a decimal?

Keep the whole number and convert the fraction part: 1 3/4 = 1 + 0.75 = 1.75. Or write it as an improper fraction first: 1 3/4 = 7/4, and 7 ÷ 4 = 1.75.

### How do I turn a fraction into a percent?

Convert it to a decimal and multiply by 100: 5/8 = 0.625 = 62.5%. The calculator shows the percent exactly, with the same bar for repeating digits (1/3 = 33.3̅%).

### How does the rounding work?

The rounded value keeps the number of decimal places you choose and always writes all of them (3/4 to 3 places is 0.750). A value exactly halfway rounds away from zero: 1.75 to 1 place is 1.8, and −1.75 is −1.8.

## Sources

- OpenStax, Prealgebra 2e, section 5.3 Decimals and Fractions (converting fractions to decimals, repeating decimals): https://openstax.org/books/prealgebra-2e/pages/5-3-decimals-and-fractions
- G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, sections 9.1 to 9.6 (terminating and recurring decimals)
