Greatest Common Divisor - GCD

Last Updated : 7 Mar, 2026

Greatest Common Divisor (GCD), also known as the Highest Common Factor (HCF), is the greatest number that divides a set of numbers without leaving a remainder.

  • For example, GCD of 12 and 18 is 6, as it divides both the numbers and is the largest of all their factors.
  • GCD of any two numbers is never negative or 0, and the least positive integer common to any two numbers is always 1.

Examples

Here are some examples of the GCD of Two Numbers:

12 and 18:
Divisors of 12 are 1, 2, 3, 4, 6 and 12
Divisors of 18 are 1, 2, 3, 6, 9 and 18
The common Divisors are 1, 2, 3 and 6. The greatest common divisor or GCD is 6

30 and 15:
Divisors of 30 are 1, 2, 3, 5, 15 and 30
Divisors of 15 are 1, 3, 5 and 15
The common Divisors are 1, 3, 5 and 15. The greatest common divisor or GCD is 15.

4 and 9:
Divisors of 4 are 1, 2 and 4
Divisors of 9 are 1, 3 and 9
There is only one common divisor 1. Hence GCD is 1.

For Beginners

This section covers the basics of GCD, different methods to find it, its properties, and real-life uses explained simply.

For Aptitude Preparation

Prepare for aptitude exams with shortcut methods, solved examples, and common GCD-related questions.

Practice Questions

Practice GCD problems of varying difficulty, including MCQs to test and improve your problem-solving skills.

For Programmers

Learn how to solve GCD-related problems using code, from basic programs to competitive programming challenges.

Comment

Explore