Beginner

GCD Calculator — Greatest Common Divisor with Steps

Enter two positive integers to find their greatest common divisor (GCD) — the largest number that divides both exactly. The Euclidean algorithm steps are shown so you can see exactly how the answer is reached.
Positive whole number.
Positive whole number.
Greatest Common Divisor
12

Largest integer that divides both numbers without a remainder

LCM (Least Common Multiple)
144
Algorithm
Euclidean
Steps
2
Euclidean algorithm — step by step
1

Divide 48 by 36

48 = 36 × 1 + 12 → remainder 12
2

Divide 36 by 12

36 = 12 × 3 + 0 → remainder 0
=

Remainder is 0 — GCD found

GCD(48, 36) = 12
结果仅为一般参考性的估算,并非专业建议——在依赖这些重要结果之前,请务必自行独立核实。 阅读完整免责声明.
快速解答

这个计算器是如何工作的?

GCD(a, b) is found by the Euclidean algorithm: repeatedly replace (a, b) with (b, a mod b) until the remainder is 0; the last non-zero value is the GCD. For example, GCD(48, 36) = GCD(36, 12) = GCD(12, 0) = 12. LCM = (a × b) / GCD.

公式
GCD(a, b) = GCD(b, a mod b) repeated until remainder = 0 • LCM(a, b) = (a × b) ÷ GCD(a, b)
How this is calculated

The greatest common divisor (GCD) of two integers is the largest integer that divides both without a remainder. It is also called the highest common factor (HCF) or greatest common factor (GCF). For example, GCD(48, 36) = 12, because 12 is the largest number that divides both 48 and 36 evenly.

This calculator uses the Euclidean algorithm, one of the oldest and fastest known algorithms. It works by repeatedly replacing the larger number with the remainder of dividing the two numbers: GCD(a, b) = GCD(b, a mod b), because any divisor of a and b is also a divisor of the remainder. When the remainder reaches 0, the other number is the GCD. The algorithm is guaranteed to terminate because remainders strictly decrease, and it runs in O(log min(a, b)) steps.

The calculator also shows the least common multiple (LCM) using the identity LCM(a, b) = (a × b) / GCD(a, b), which follows because the product of two integers equals the product of their GCD and LCM. Both results are exact integers — no rounding is involved.

常见问题

GCD (greatest common divisor) is the largest number that divides both integers evenly. LCM (least common multiple) is the smallest positive number that both integers divide into evenly. They are related by GCD × LCM = a × b.

GCD is used to simplify fractions (divide numerator and denominator by the GCD), find common denominators, solve Diophantine equations, and in cryptography (RSA key generation uses the extended Euclidean algorithm).

Yes. Greatest common divisor (GCD), highest common factor (HCF), and greatest common factor (GCF) all refer to the same value — the largest integer that divides a set of numbers without a remainder.

也称为

最大公约数计算器
最大公因数计算器
gcd计算器
辗转相除法计算器
求两个数的最大公约数
最大公约数怎么求
最大公约数和最小公倍数计算器
欧几里得算法计算器

APA

TG we-Calculate Editorial Team. (2026). GCD Calculator — Greatest Common Divisor with Steps [Online calculator]. TG we-Calculate. https://we-calculate.com/zh/calculator/gcd-calculator

Chicago

TG we-Calculate Editorial Team. "GCD Calculator — Greatest Common Divisor with Steps." TG we-Calculate. 2026. https://we-calculate.com/zh/calculator/gcd-calculator.

IEEE

TG we-Calculate Editorial Team, "GCD Calculator — Greatest Common Divisor with Steps," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/zh/calculator/gcd-calculator

BibTeX

@misc{wecalculate_gcd_calculator, title = {GCD Calculator — Greatest Common Divisor with Steps}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/zh/calculator/gcd-calculator}}, year = {2026}, note = {TG we-Calculate} }

这个计算器对您有帮助吗?