{
  "id": "gcf",
  "version": "25bdd333eabf",
  "status": "published",
  "name": "GCF Calculator",
  "question": "What is the GCF of my numbers?",
  "summary": "Finds the greatest common factor (GCF) of two or more numbers, exactly, however large they are.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/gcf-calculator",
  "markdown": "https://www.acalculator.org/math/gcf-calculator.md",
  "kind": "function",
  "method": "Euclid’s algorithm on the whole numbers, GCF(a, b, c) = GCF(GCF(a, b), c); decimals are scaled by a power of ten.",
  "assumptions": [
    "Negative numbers count by their absolute value: GCF(−12, 18) = 6.",
    "A 0 in the list does not change the GCF: GCF(0, 5) = 5. The GCF of only zeros is 0.",
    "Decimals are exact as typed: every number is multiplied by the same power of ten to make it whole, and the GCF is divided by it again.",
    "Whole numbers keep every digit. Very large numbers typed in the box are read as 64-bit floats, so enter whole numbers below 9,007,199,254,740,992 (2^53) to keep them exact."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "input": {
        "title": "Your numbers",
        "description": "Two or more numbers, separated by commas, spaces, semicolons, or new lines.",
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    }
  },
  "outputs": {
    "gcf": {
      "label": "Greatest common factor",
      "description": "The largest number that divides every number in the list a whole number of times.",
      "format": "number"
    },
    "numbers": {
      "label": "Numbers",
      "description": "The numbers as read from the list, written without thousands separators.",
      "format": "text"
    },
    "note": {
      "label": "Decimals",
      "description": "Shown when a number has decimals: how the GCF of decimals is found.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "input": "12, 18, 24"
    },
    "outputs": {
      "gcf": "6",
      "numbers": "12, 18 and 24"
    },
    "text": "The greatest common factor of 12, 18 and 24 is 6."
  },
  "examples": [
    {
      "given": {
        "input": [
          12,
          18,
          24
        ]
      },
      "expect": {
        "gcf": 6
      },
      "source": "hand calculation in content.mdx: 12 = 2²×3, 18 = 2×3², 24 = 2³×3; lowest powers 2×3 = 6; OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping"
    },
    {
      "given": {
        "input": [
          1071,
          462
        ]
      },
      "expect": {
        "gcf": 21
      },
      "source": "Euclid’s algorithm, worked in content.mdx: 1071 = 2×462 + 147, 462 = 3×147 + 21, 147 = 7×21; OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping"
    },
    {
      "given": {
        "input": [
          17,
          19
        ]
      },
      "expect": {
        "gcf": 1
      },
      "source": "hand calculation in content.mdx: 17 and 19 are prime; OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping"
    },
    {
      "given": {
        "input": [
          2.5,
          5
        ]
      },
      "expect": {
        "gcf": 2.5
      },
      "source": "hand calculation in content.mdx: ×10 gives 25 and 50, GCF 25, ÷10 = 2.5; OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping"
    },
    {
      "given": {
        "input": [
          -12,
          18
        ]
      },
      "expect": {
        "gcf": 6
      },
      "source": "hand calculation in content.mdx: the GCF uses absolute values, GCF(12, 18) = 6; OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping"
    }
  ],
  "sources": [
    "OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping"
  ],
  "related": [],
  "changelog": [
    {
      "date": "2026-09-28",
      "note": "The answer lists the numbers as 12, 18 and 24, without thousands separators; decimals get a note."
    },
    {
      "date": "2026-09-29",
      "note": "Worked examples name a published reference for their rule."
    }
  ]
}
