GCD / LCM Calculator
Enter integers to calculate GCD (HCF) and LCM. Supports multiple numbers (comma-separated) and shows Euclidean steps for the first two.
Integers only. Examples: 12,18 · 24, 60, 90 · negatives allowed.
Privacy: calculations run locally in your browser. No inputs are stored or transmitted.
How it works
GCD (Euclidean algorithm): repeatedly apply division with remainder until remainder is 0.
LCM: for two numbers, LCM(a,b) = |a×b| ÷ GCD(a,b) (when not both 0).
For multiple numbers, compute pairwise: GCD(a,b,c) = GCD(GCD(a,b),c), similarly for LCM.
Examples
- 12, 18 → GCD = 6, LCM = 36
- 24, 60, 90 → GCD = 6, LCM = 360
- -8, 12 → GCD = 4, LCM = 24
- 10, 0 → GCD = 10, LCM = 0
When to use this tool
This tool is designed for quick, practical tasks such as everyday calculations, data formatting, or simple conversions. It is best used when you need fast results without installing software or using complex tools.
When to use
- Quick checks or one-time calculations
- Validating or converting data before using it elsewhere
- Simple tasks that do not require advanced software
When not to use
- Critical financial, legal, or medical decisions
- Large-scale or automated processing
- Situations requiring guaranteed precision beyond basic validation
Always review results before using them in important contexts.
About this tool
This tool helps you perform quick utility operations directly in your browser. It runs entirely in your browser without sending data to a server.
You can use this tool when handling simple tasks without installing additional software. The results should be interpreted as a processed output based on your input data.
FAQ
- What is GCD (greatest common divisor)?
GCD is the largest positive integer that divides each number with no remainder. It is also called HCF.
- What is LCM (least common multiple)?
LCM is the smallest positive integer that is a multiple of each number.
- Can I enter more than two numbers?
Yes. Enter a comma-separated list like 12, 18, 30. The calculator reduces pairwise across the list.
- Do negative numbers work?
Yes. GCD and LCM are computed using absolute values. LCM is reported as a positive number.
- What about zeros?
GCD(a, 0) = |a|. LCM(a, 0) is 0 by convention. If all inputs are 0, both results are 0.
- How are GCD and LCM related?
For two integers a and b (not both 0), |a×b| = GCD(a,b) × LCM(a,b).