Greatest common factor calculator
Get the greatest common factor of two or more whole numbers along with every factor they share: 12, 18 and 24 share 1, 2, 3 and 6, so their GCF is 6. Made for school worksheets and homework checks. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Numbers
- 12, 18, 24
- Quantity
- 3
- Gcf
- 6
- Common factors
- 1, 2, 3, 6
- Factor count
- 4
The greatest common factor of two or more whole numbers is the largest integer that divides every one of them without a remainder. Elementary and middle-school programs introduce that idea as GCF before they rename it greatest common divisor in later number theory. Students list factor pairs, circle the overlap, and check that the leftover of each division is zero. This school calculator accepts two or more positive whole numbers, runs the Euclidean algorithm so large classroom examples stay exact, and returns the GCF together with every shared factor, the reduced quotients, and a short identity you can write next to a worksheet. Failed input is not billed.
What the greatest common factor of whole numbers means
A factor of a whole number is another whole number that divides it exactly, leaving remainder zero. The common factors of a list are the factors that appear in every list. The greatest common factor is simply the largest of those shared factors.
For twelve and eighteen the factors of twelve are one, two, three, four, six, and twelve; the factors of eighteen are one, two, three, six, nine, and eighteen; the overlap is one, two, three, and six; so the GCF is six. Prime-factor language says the same thing: write each number as a product of primes and keep the lowest power of every prime that appears in all of them.
Twelve is two squared times three and eighteen is two times three squared, so the overlap is two times three, which is six. Listing factors is perfect for small homework numbers and becomes painful once the values grow. The Euclidean algorithm replaces the listing: replace the larger number by the remainder of the larger divided by the smaller, and repeat until a remainder of zero appears; the last non-zero remainder is the GCF.
Folding that pairwise step across three or more numbers yields the GCF of the whole list, because any common divisor of a, b, and c is a common divisor of gcd(a, b) and c. The contract here is two or more positive whole numbers in and one GCF out, plus the shared-factor list a teacher would tick on a worksheet.
What you can enter and what you get back
Zero and negative integers are rejected because school GCF problems use positive whole numbers, and the GCF of zero with zero is not a classroom object. Values must sit between one and one trillion inclusive so every remainder in the Euclidean loop stays inside safe integer arithmetic. Example: numbers twelve, eighteen, and twenty-four yield GCF six, common factors one, two, three, and six, reduced values two, three, and four, and the identity twelve equals six times two, eighteen equals six times three, twenty-four equals six times four.
A pair such as eight and fifteen is coprime: the only common factor is one. Those validation failures are not billed.
Where a school GCF calculator earns its keep
Classrooms and tutoring platforms use a greatest common factor calculator so learners can check the GCF of two or more whole numbers without dropping a factor pair. Homework generators and learning-management graders need a deterministic oracle that marks a listing of common factors wrong when the student missed the largest one, and that never invents a factor that fails to divide every input.
Parents checking a fifth-grade packet want the same number the teacher will mark: the largest whole number that divides each entry with remainder zero, written in classroom GCF language rather than as a programming gcd. Failed validation does not consume balance. When the search is least common multiple, fraction simplification, or a combined GCD and LCM calculator, use those dedicated landings; this page stays on the elementary greatest common factor of whole numbers.
What you can do with it
Classroom and homework checks
Let students submit two or more whole numbers and verify the GCF, the shared-factor list, and the reduced quotients against the factor trees they drew by hand.
Exam and LMS auto-grading
Mark GCF items with a deterministic oracle that never accepts a common factor that fails to divide every input and never invents a larger answer than the Euclidean result.
Simplifying ratios and grouping problems
Divide each quantity by the GCF to write a ratio in lowest terms or to split a class into the largest equal groups with nothing left over.
FAQ
How do I find the greatest common factor of two or more whole numbers?
Send an array of at least two positive whole numbers in numbers. Example: 12, 18, and 24 yield GCF 6.
What is the difference between GCF and GCD?
They are the same integer. GCF is the school name (greatest common factor); GCD is the later name (greatest common divisor). This landing uses classroom GCF language.
What happens if the numbers share no factor larger than 1?
They are coprime. Eight and fifteen are a typical pair.
Can I send only one number, or a zero?
GCF is defined here for two or more positive whole numbers; zero and a singleton list are rejected and not billed.
How do I find the GCF with prime factors?
Write each number as a product of primes and keep the lowest power of every prime they all share. Twelve is two squared times three and eighteen is two times three squared, so the GCF is two times three, which is six.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/edu/gcf-school \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"numbers":[12,18,24]}'const res = await fetch("https://api.kit.forhosting.com/edu/gcf-school", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"numbers": [
12,
18,
24
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/edu/gcf-school",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"numbers": [
12,
18,
24
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/edu/gcf-school", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"numbers":[12,18,24]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"numbers":[12,18,24]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/edu/gcf-school", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"numbers": [
12,
18,
24
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "edu.gcf_school",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_items | 20 |
max_value | 1000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Every successful API call costs $0.002.
What the greatest common factor of whole numbers means
This endpoint uses that fold. It does not compute a least common multiple, which is a different school search, and it does not simplify a single fraction — that landing already exists.
Input contract, response shape, and error behaviour
POST a JSON body with one required field, numbers: an array of at least two and at most twenty positive whole numbers. Each entry may arrive as a JSON integer or as a digit string; empty strings, decimals, booleans, infinities, and missing fields fail with invalid_input naming numbers. On success the body echoes the parsed numbers and their count, then returns gcf (the greatest common factor), common_factors (every positive divisor of that GCF, which is exactly the set of integers that divide every input), factor_count, coprime (true when the GCF is one), reduced (each input divided by the GCF), identity (a classroom string such as twelve equals six times two), and formula. Pair the integers with your own factor-tree drawing if you need a worksheet graphic; this endpoint solves the arithmetic and lists the shared factors, it does not emit a picture.
Where a school GCF calculator earns its keep
Keep requests inside the published whole-number limits, pin gcf, common_factors, and identity in tests, and you get reproducible factors for worksheets, LMS plugins, and edge workers without standing up a computer-algebra system for a two-integer problem.
Technical questions
What does the greatest common factor calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.