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 計算機
hcf 計算
最大公因數 最小公倍數 計算

APA

TG we-Calculate Editorial Team. (2026). GCD Calculator — Greatest Common Divisor with Steps [Online calculator]. TG we-Calculate. https://we-calculate.com/zh-tw/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-tw/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-tw/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-tw/calculator/gcd-calculator}}, year = {2026}, note = {TG we-Calculate} }

這個計算機對您有幫助嗎?