ForHosting KIT · Math

Greatest common factor calculator

Enter a list of integers and get the largest number that divides every one of them: 12, 18 and 24 share 6. Up to forty values at once, minus signs never change the answer, and a list of only zeros is refused. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Numbers
12, 18, 24
You get
Quantity
3
Gcf
6

The greatest common factor of a list of integers is the largest positive integer that divides every listed value without remainder. Students meet this idea as GCF in elementary number sense, then again when they simplify ratios, reduce fractions, and pull a common factor out of a set of measurements. This greatest common factor calculator accepts a list of whole numbers, takes the absolute value of each term so a minus sign never changes the answer, and reduces the list with the Euclidean algorithm until a single positive factor remains.

What the greatest common factor is and how Euclidean reduction finds it

The greatest common factor of two or more integers is the largest positive integer that divides every listed value without a remainder. School courses call it GCF or HCF; number theory calls the same object the greatest common divisor. Signs do not change the factor: twelve and negative eighteen share the factor six, because divisibility is defined on absolute values.

Zero is divisible by every integer, so the GCF of zero and twelve is twelve, but a list that contains only zeros has no positive common factor and is rejected. The Euclidean algorithm computes the binary GCF without listing prime factors. For a pair a and b it replaces a with b and b with a modulo b until the remainder is zero; the last non-zero remainder is gcd(a, b).

Example: twelve, eighteen, and twenty-four. gcd(12, 18) is six because 18 equals 1 times 12 plus 6 and 12 equals 2 times 6 plus 0; then gcd(6, 24) is six. The capability returns that positive six, never a negative factor and never a padded product of the inputs. Prime factorization would give the same answer but is slower for large magnitudes and easier to get wrong by dropping a shared prime; Euclidean reduction uses only remainders and is exact on every safe integer in the contract.

A single integer is allowed: the GCF of one value is its absolute value, which matches the definition that every integer divides itself.

Where a greatest common factor helps

Classrooms and tutoring platforms use a greatest common factor calculator so learners can check the Euclidean-reduction step without listing primes by hand or forgetting that a minus sign does not change the factor. Exam-prep generators need a deterministic oracle that marks an empty list or a decimal such as twelve-point-five as invalid input instead of silently truncating and returning a plausible but wrong GCF. Failed validation does not consume balance.

Keep requests inside the forty-integer cap, pin the integer gcf in tests, and you get reproducible common factors for homework, LMS plugins, and edge workers without standing up symbolic math infrastructure of your own.

Classroom and homework checks

Let students submit a list of integers and verify the positive GCF against the Euclidean method taught in class, including lists that mix signs.

Exam and LMS auto-grading

Mark GCF items with a deterministic oracle that rejects an empty list or a non-integer entry and never truncates a decimal into a silent wrong answer.

Ratio reduction and grouping scripts

Find the common factor of a column of integer measurements before simplifying a ratio, packing equal groups, or rescaling a grid, without a computer-algebra library.

How is the greatest common factor of a list of integers computed?

The calculator takes the absolute value of each integer and folds the Euclidean algorithm across the list.

Do negative numbers change the greatest common factor?

No. Divisibility uses absolute values, so the GCF is always returned as a positive integer. The GCF of −12 and 18 is 6, the same as the GCF of 12 and 18.

What is the GCF of coprime integers, or of a single integer?

Coprime integers such as 8 and 15 have GCF 1. A list of one integer is allowed: the GCF of that value is its absolute value. A list of only zeros is rejected because 0 is not a positive factor.

How many numbers can I enter at once?

Anything from a single integer up to forty of them in one list. With one value the answer is simply its absolute value, because every integer divides itself.

What happens if the list contains a zero?

Zero is divisible by every integer, so it does not change the answer: the factor is worked out from the other numbers. A list made only of zeros is refused, because it has no positive common factor.

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.

POSThttps://api.kit.forhosting.com/math/greatest-common-factor

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.

curl -X POST https://api.kit.forhosting.com/math/greatest-common-factor \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers":[12,18,24]}'
{
  "numbers": [
    12,
    18,
    24
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.greatest_common_factor",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_items40
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

An empty list and any non-integer entry are rejected with invalid_input instead of a hollow zero. Failed validation is not billed; successful calls use the published $0.002 base price with no model tokens and no outbound network.

What the greatest common factor is and how Euclidean reduction finds it

Associativity lets the same step fold across a list: gcd(a, b, c) equals gcd(gcd(a, b), c).

Input contract, response shape, and error behaviour

A list of zeros is rejected because zero is not a positive factor; mixing zero with a non-zero integer is valid and returns the GCF of the non-zero terms. On success the body returns numbers, the parsed integers in input order with their original signs; count, the length of that list; gcf, the positive greatest common factor; and formula, the string gcf equals gcd of the absolute values via the Euclidean algorithm. Example: twelve, eighteen, and twenty-four yield gcf six. Example: negative forty-eight, eighteen, and thirty also yield gcf six. POST a JSON body with one required field, numbers, an array of one to forty integers. Each entry may arrive as a JSON integer or as a whole decimal string with an optional leading sign; booleans, objects, fractions, scientific notation, Infinity, and NaN fail with invalid_input naming the index. Missing numbers, an empty array, or more than forty entries fail with invalid_input. Pair the response with your own LCM step if you need a least common multiple as well; this endpoint returns only the positive common factor and does not emit prime factors, a factor tree, or a step-by-step remainder table beyond the formula field.

Where a greatest common factor API earns its keep

Worksheet and LMS plugins that ask students to simplify a ratio or reduce a fraction can call this endpoint first, show the positive factor, and only then ask for the reduced form, which keeps the grading of the GCF step separate from the grading of the division step. Spreadsheet and notebook workflows often need the GCF of a column of integer measurements before they rescale a grid, pack items into equal groups, or convert mixed units to a common tick; calling a tiny parse API avoids pulling a full computer-algebra system for a short remainder loop.

What happens if the list is empty or contains a non-integer?

The task fails with invalid_input. An empty list and any non-integer entry (a decimal, boolean, or object) are rejected and are not billed.

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.

Read the full KIT documentation →