---
title: Cartesian Product Calculator
description: Calculate the Cartesian product of two sets — every ordered pair (a, b) from A × B.
---

# Cartesian Product Calculator

Use this **calculator** to compute the *Cartesian product* of two sets: every ordered pair with a first element from set **A** and a second from set **B**.

Site: [https://setcalculators.com/cartesian-product.html](https://setcalculators.com/cartesian-product.html)

## Definition

The Cartesian product **A × B** is the set of all ordered pairs `(a, b)` where `a ∈ A` and `b ∈ B`.

If **A** has *m* elements and **B** has *n* elements, then **A × B** has *m × n* pairs.

## Example

Shirt colors: `{red, blue}`  
Shirt sizes: `{S, M, L}`

Product:

```
(red, S), (red, M), (red, L),
(blue, S), (blue, M), (blue, L)
```

## Properties

- **Order matters** — `(a, b)` is not the same as `(b, a)`. Swapping the input sets changes the product.
- **Empty set** — if either set is empty, the product is empty.
- **Duplicates** — each input is treated as a set; duplicate items are counted once before pairs are generated.

## Input and output

- Separate items with commas, spaces, or new lines.
- Format output with quotes, new lines, and/or commas in the UI.
- Very large products may be capped in the browser UI for performance.

## Related

- [Set operations](https://setcalculators.com/) — union, intersection, difference
- [List unique](https://setcalculators.com/list-unique.html)
- [Sort & reverse](https://setcalculators.com/list-sort.html)
- [All calculators](https://setcalculators.com/calculators.html)

## Discovery

- Catalog: `/calculators.md`
- OpenAPI: `/openapi.json`
- Auth / access notes: `/auth.md`
