# How do I do long multiplication?

Multiplies two numbers exactly, whole numbers or decimals of any length, and shows the long multiplication: each partial product, their sum, and the decimal point.

- Page: https://www.acalculator.org/math/multiplication-calculator
- JSON spec: https://www.acalculator.org/math/multiplication-calculator.json
- Version: 161529ffb80f

## Default answer

Example with the default inputs (First number 123, Second number 45): 123 × 45 = 5535.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| a | First number | The number to multiply, such as 123, -4.5 or 1,234.56. |
| b | Second number | The number to multiply by; the working takes one partial product per digit of it. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| product | Product | The exact product of the two numbers. |
| steps | Long multiplication | The partial products, their sum, the decimal point, and the sign. |
| problem | Problem | The two numbers with the × sign, written out in full. |

## Method

Multiply without the decimal points: one partial product per non-zero digit of the second number (the first number times that digit and its place value), then add them; the product has as many decimal places as both numbers together.

## Assumptions

- Each number is read exactly as typed, with any number of digits; the product is exact.
- A digit 0 in the second number gives no partial product.
- The product is negative when exactly one number is negative.

## Worked examples

1. a = 123, b = 45 gives product = 5535, steps = 123 × 5 = 615; 123 × 40 = 4920; Add the partial products: 615 + 4920 = 5535. Source: Method from OpenStax Prealgebra 2e, section 1.4: https://openstax.org/books/prealgebra-2e/pages/1-4-multiply-whole-numbers.
2. a = 12.3, b = 4.5 gives product = 55.35, steps = Set the decimal points aside: 123 × 45; 123 × 5 = 615; 123 × 40 = 4920; Add the partial products: 615 + 4920 = 5535; 1 + 1 = 2 decimal places: 55.35.
3. a = -2.5, b = 0.4 gives product = -1, steps = Set the decimal points aside: 25 × 4; 25 × 4 = 100; 1 + 1 = 2 decimal places: 1.00; One number is negative, so the product is negative: -1.
4. a = 987654321, b = 123456789 gives product = 121932631112635269.
5. a = 2,048, b = 305 gives product = 624640, steps = 2048 × 5 = 10240; 2048 × 300 = 614400; Add the partial products: 10240 + 614400 = 624640.

## FAQ

### How does long multiplication work?

Multiply the top number by each digit of the bottom number, one at a time, shifting one place left for each digit (a partial product), then add the partial products. 123 × 45: 123 × 5 = 615 and 123 × 40 = 4920, and 615 + 4920 = 5535.

### How do I multiply decimals?

Multiply as if there were no decimal points, then count the decimal places in both numbers together and give the product that many. 12.3 × 4.5: 123 × 45 = 5535, and 1 + 1 = 2 places gives 55.35.

### What happens with a zero in the second number?

A 0 digit gives a partial product of 0, so you can skip it, as long as the next partial product still moves to the right place. 2,048 × 305 = 2048 × 5 + 2048 × 300 = 10240 + 614400 = 624640.

### What is the sign of the product?

A positive times a positive, or a negative times a negative, is positive. When exactly one number is negative, the product is negative: −2.5 × 0.4 = −1.

### Can I multiply very large numbers?

Yes. The calculator works with every digit you type (up to 40 characters per number), so 987654321 × 123456789 gives the exact product 121932631112635269, with no rounding.

### Does the order of the numbers matter?

Not for the answer: a × b = b × a. The working takes its partial products from the digits of the second number, so putting the number with fewer non-zero digits second gives shorter working.

## Sources

- OpenStax, Prealgebra 2e, section 1.4 Multiply Whole Numbers (multi-digit multiplication): https://openstax.org/books/prealgebra-2e/pages/1-4-multiply-whole-numbers
- OpenStax, Prealgebra 2e, section 5.2 Decimal Operations (multiplying decimals): https://openstax.org/books/prealgebra-2e/pages/5-2-decimal-operations
