GCD & LCM Calculator

Calculate the greatest common divisor and least common multiple for two or more integers

Example Results

1 examples

Compare the common divisor and multiple for a number set

Find the shared divisor and the smallest shared multiple for several integers in one run.

{
  "result": {
    "gcd": 6,
    "lcm": 72
  }
}
View input parameters
{ "numbers": "12, 18, 24", "calculationType": "both" }

Key Facts

Category
Math, Date & Finance
Input Types
text, select
Output Type
json
Sample Coverage
4
API Ready
Yes

Overview

The GCD & LCM Calculator is a straightforward mathematical utility designed to instantly find the greatest common divisor and least common multiple for any set of integers. Whether you are simplifying fractions, solving scheduling problems, or working on number theory assignments, this tool processes multiple comma-separated numbers at once to deliver accurate results in a structured JSON format.

When to Use

  • When you need to simplify complex fractions by finding the greatest common divisor of the numerator and denominator.
  • When aligning schedules, repeating events, or gear ratios that require finding the least common multiple.
  • When verifying manual math calculations for number theory assignments involving multiple integers.

How It Works

  • Enter two or more integers separated by commas into the Numbers field.
  • Select your desired calculation type: GCD only, LCM only, or both.
  • Submit the form to instantly generate a JSON output containing the calculated mathematical values.

Use Cases

Simplifying algebraic expressions and fractions in educational settings.
Determining the synchronization point for multiple periodic events, such as overlapping work shifts or transit schedules.
Optimizing packaging and cutting materials into equal-sized pieces without waste.

Examples

1. Synchronizing Transit Schedules

Logistics Planner
Background
A planner is coordinating three bus routes that loop every 12, 18, and 24 minutes respectively.
Problem
Finding the exact time when all three buses will arrive at the main terminal simultaneously.
How to Use
Enter '12, 18, 24' in the Numbers field and select 'Both GCD and LCM' or 'LCM only'.
Example Config
Calculation Type: both
Outcome
The tool outputs an LCM of 72, indicating the buses will sync up every 72 minutes.

2. Cutting Materials into Equal Pieces

Carpenter
Background
A carpenter has wooden boards of lengths 48, 72, and 120 inches.
Problem
Cutting all boards into the longest possible equal segments without any leftover wood.
How to Use
Input '48, 72, 120' into the Numbers field and select 'GCD only'.
Example Config
Calculation Type: gcd
Outcome
The tool returns a GCD of 24, meaning the boards should be cut into 24-inch segments.

Try with Samples

math-&-numbers

Related Hubs

FAQ

Can I calculate the GCD and LCM for more than two numbers?

Yes, you can enter as many integers as you need, separated by commas, and the tool will compute the result for the entire set.

What format should I use for the input numbers?

Enter whole numbers separated by commas, such as '12, 18, 24'.

Can I choose to only calculate the LCM?

Yes, the Calculation Type dropdown allows you to select 'LCM only', 'GCD only', or 'Both GCD and LCM'.

Does this tool support decimal numbers?

No, GCD and LCM calculations are mathematically defined for integers (whole numbers) only.

How are the results formatted?

The results are returned as a structured JSON object containing the requested GCD and/or LCM values.

API Documentation

Request Endpoint

POST /en/api/tools/gcd-lcm-calculator

Request Parameters

Parameter Name Type Required Description
numbers text Yes -
calculationType select Yes -

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-gcd-lcm-calculator": {
      "name": "gcd-lcm-calculator",
      "description": "Calculate the greatest common divisor and least common multiple for two or more integers",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=gcd-lcm-calculator",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]