# Plumbing Pipe Sizing Calculator (IPC) (`jumblemog/plumbing-calculator`) Actor

IPC plumbing sizing from plain text: fixture units, peak water demand (Hunter's method) and water service, cold and hot pipe sizes with a pressure check, building drain, branch, stack and vent sizes, and pipe velocity and friction loss.

- **URL**: https://apify.com/jumblemog/plumbing-calculator.md
- **Developed by:** [Jumble Mog](https://apify.com/jumblemog) (community)
- **Categories:** AI, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Plumbing Pipe Sizing Calculator (IPC)

**Size the water supply and drain pipes for a list of plumbing fixtures by the International Plumbing Code, from one line of text.** Ask `2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs`, `water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length` or `12 gpm through 3/4 in PEX, 80 ft` and you get back:

- **Fixture units** for every fixture: water supply fixture units (cold, hot and total, private or public) and drainage fixture units, with each fixture's trap size, minimum supply pipe and minimum flow pressure.
- **Peak demand** in gpm by Hunter's method (IPC Appendix E, Table E103.3(3)), with the flush valve curve when there are flushometer valves.
- **Water pipe sizes**: the water service and the cold and hot mains in copper (type K, L or M), PEX, CPVC, PVC or galvanized steel, kept under the velocity limit and, when you give the street pressure and length, under the friction the pressure allows (the Appendix E method: elevation, meter loss and the fixture's minimum pressure taken off first).
- **Drain sizes**: the building drain at your slope (and at every slope), the horizontal branch, the stack and the minimum vent (Tables 710.1(1) and 710.1(2), 906.2).
- **One pipe**: velocity and Hazen-Williams friction loss at a flow, or the smallest size that stays under 8 ft/s.
- **A chart** and a **Markdown report** for each request.

It's made for:

- Plumbers, contractors, remodelers and DIYers checking pipe sizes for a house, addition or tenant fit-out.
- Designers, estimators, inspectors and students who want the fixture unit math done and shown.
- AI agents and building or quoting apps that need code-based plumbing sizes they can explain.

![A chart made by this Actor for a house with 2 bathrooms, a kitchen sink, dishwasher, clothes washer and 2 hose bibbs: 16.4 water supply fixture units and 18.2 gpm, with the velocity in each copper size (1 in chosen at 7.1 ft/s under the 8 ft/s limit), and 16 drainage fixture units on a 3 in building drain at 1/4 in per foot](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/plumbing-calculator-example.png?signature=idG4P6uGR7HMwrhKxHvM)

### How to use it

1. Write **Requests**, one per entry. The form has examples.
2. Optionally set the **Default pipe material** (copper type L otherwise) and **Default occupancy** (private homes or public buildings).
3. Click **Start**. Each request is a row in the results, with its summary, chart and report.

#### What you can write

| You write | It means |
|---|---|
| `2 bathrooms`, `2.5 baths`, `half bath`, `powder room` | Bathroom groups (a water closet, lavatory and tub or shower), half baths add a water closet and a lavatory |
| `kitchen sink`, `dishwasher`, `clothes washer`, `laundry tray`, `bar sink`, `service sink` | Kitchen and laundry fixtures |
| `3 water closets`, `toilets`, `4 lavatories`, `2 urinals`, `showers`, `bathtub`, `bidet` | Bathroom fixtures, counted one by one |
| `floor drain`, `hose bibbs`, `drinking fountain` | Others; `kitchen sink x 2` counts too |
| `45 WSFU`, `120 DFU` | Fixture units you already have |
| `water supply`, `drainage` | Only one side (both by default) |
| `public`, `restroom`, `office`; `flush valves` | Public fixture units; flushometer valve fixtures |
| `PEX`, `CPVC`, `type K copper`, `PVC`, `galvanized` | Pipe material |
| `60 psi`, `20 ft elevation` or `3-story`, `120 ft developed length`, `meter loss 5 psi`, `fittings 30%` | The pressure check |
| `1/8 in per ft`, `2% slope` | Building drain slope (1/4 in per ft by default) |
| `12 gpm through 3/4 in PEX, 80 ft`, `25 gpm copper`, `max 6 ft/s` | One pipe |

The same as an object: `{"fixtures": {"kitchen sink": 1, "bathroom group": 2}, "type": "supply", "pressure": "50 psi", "length": "100 ft", "material": "CPVC"}` or `{"type": "drain", "dfu": 120, "slope": "1/4"}`.

### Examples

- `2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs` → 16.4 WSFU, 18.2 gpm: 1 in type L copper service and mains; 16 DFU on a 3 in building drain at 1/4 in/ft, 3 in stack, 1-1/2 in vent.
- `water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length` → 14.3 WSFU, 17.1 gpm; 60 - 8.7 (elevation) - 20 (shower minimum) = 31.3 psi over 180 ft equivalent = 17.4 psi per 100 ft; 1-1/4 in PEX service and cold main, 1 in hot main.
- `drainage for 3 bathroom groups, kitchen sink, clothes washer, laundry tray, floor drain, 1/8 in per ft` → 23 DFU: 3 in building drain (36 DFU at 1/8 in/ft), 4 in if all on one horizontal branch (3 in carries 20), 3 in stack.
- `public restroom water supply: 4 water closets with flush valves, 3 urinals, 4 lavatories, drinking fountain, 55 psi, meter loss 6 psi, length 150 ft` → 63.25 WSFU on the flush valve curve = 55.3 gpm: 2 in service.
- `12 gpm through 3/4 in PEX, 80 ft` → 10.9 ft/s (over 8 ft/s: use 1 in), 29.6 psi per 100 ft, 23.7 psi over 80 ft.

### How-to examples

Each example is a complete input; the results are from runs of the Actor (also listed under **Examples**).

#### How to size water supply and drain pipes for a house (IPC)

```json
{"requests": ["2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs"]}
```

Result: 16.4 WSFU and 18.2 gpm: a 1 in type L copper service and mains; 16 DFU on a 3 in building drain at 1/4 in/ft, a 3 in stack and a 1-1/2 in vent.

#### How to size a water service with a pressure check

```json
{"requests": ["water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length"]}
```

Result: 14.3 WSFU and 17.1 gpm; 60 − 8.7 (elevation) − 20 (shower minimum) = 31.3 psi over 180 ft equivalent, 17.4 psi per 100 ft; a 1-1/4 in PEX service and cold main and a 1 in hot main.

#### How to find pipe velocity and friction loss for a flow

```json
{"requests": ["12 gpm through 3/4 in PEX, 80 ft"]}
```

Result: 10.9 ft/s, over 8 ft/s, so use 1 in; 29.6 psi per 100 ft and 23.7 psi over 80 ft.

#### How to let an AI agent size plumbing

Add this Actor to the [Apify MCP server](https://mcp.apify.com) with `https://mcp.apify.com/?tools=jumblemog/plumbing-calculator`. The agent lists the fixtures in one line and answers with the fixture units, demand in gpm and the pipe sizes.

### FAQ

**Which code does it follow?** The International Plumbing Code: fixture units from Table 709.1 and Appendix E, Hunter's curve for demand, drains from Table 710.1 and vents by 906.2.

**Does it handle flush valves and public restrooms?** Yes. `public restroom water supply: 4 water closets with flush valves, 3 urinals, ...` uses the public fixture units and the flush valve curve: 63.25 WSFU, 55.3 gpm and a 2 in service.

**Which pipe materials does it know?** Copper, PEX, CPVC, PVC and galvanized steel, with Hazen-Williams friction on the actual inside diameters.

**Does it follow the UPC?** No. UPC fixture units and tables differ, and your local code and the authority having jurisdiction have the final word.

### Input

| Field | What it is |
|---|---|
| `requests` | Requests, as lines of text or objects (up to 200 per run) |
| `material`, `occupancy` | Defaults when a request doesn't say |
| `charts` | Draw a chart for each request (default on) |

### Output

One dataset item per request, also saved together in the run's `OUTPUT` record:

```json
{
  "request": 1, "status": "ok", "type": "both", "title": "Plumbing sizing",
  "summary": "2 bathroom groups, 1 kitchen sink, 1 dishwasher, 1 clothes washer standpipe, 2 hose bibbs. Water: 16.4 WSFU, 18.2 gpm; service 1\", cold 1\", hot 1\" (Copper tube type L). Drainage: 16 DFU; building drain 3\" at 1/4 in/ft, stack 3\", vent at least 1-1/2\".",
  "fixtures": [{"fixture": "Bathroom group (water closet, lavatory, tub or shower)", "count": 2, "dfuEach": 5, "dfu": 10, "trap": "3\"",
                "wsfuCold": 5.4, "wsfuHot": 3, "wsfu": 7.2, "minSupply": null, "minPressure": 20, "flushValve": false}],
  "wsfu": {"cold": 12.4, "hot": 6.4, "total": 16.4},
  "demand": {"totalGpm": 18.16, "coldGpm": 16.2, "hotGpm": 11.14, "flushValve": false},
  "pipeSizes": {"service": "1\"", "coldMain": "1\"", "hotMain": "1\""},
  "dfu": 16, "slope": 0.25,
  "drainSizes": {"buildingDrain": "3\"", "horizontalBranch": "3\"", "stack3Intervals": "3\"", "stackOver3Intervals": "3\"", "vent": "1-1/2\""},
  "units": {"pressure": "psi", "flow": "gpm", "length": "ft", "size": "in", "velocity": "ft/s", "friction": "psi per 100 ft"},
  "imageUrl": "https://api.apify.com/v2/key-value-stores/.../records/001-Plumbing-sizing.png"
}
```

Items also have `pipeTable` (every size with its velocity and friction), `pressure` (the pressure budget), `drainBySlope` and `drainCapacity`, `warnings`, `notes` (every assumption), a Markdown `report` and links to the chart and report. A pipe request has `velocity`, `friction`, `loss` and `frictionCurve`. A request that can't be computed has `"status": "failed"` and the reason in `error`, and isn't billed.

### How it works

1. **Fixture units** come from IPC Table 709.1 (drainage) and Table E103.3(2) (water supply, private or public), with 6 DFU for water closets over 1.6 gpf.
2. **Demand** is read from Table E103.3(3) (Hunter's curve), interpolated, separately for the total, the cold and the hot water.
3. **Water pipes**: the smallest size that keeps velocity under 8 ft/s (5 ft/s for hot water in copper) and, with a pressure check, friction under (street pressure − 0.433 psi per ft of elevation − meter loss − the highest fixture minimum of Table 604.3) ÷ (developed length + 50% for fittings). The water service is at least 3/4 in (603.1).
4. **Drains**: the smallest size whose capacity in Table 710.1(1) or 710.1(2) covers the DFU, never less than 3 in with a water closet or than the largest trap; vents by 906.2.
5. **Friction** is Hazen-Williams with C = 140 for copper, 150 for plastics and 100 for galvanized steel, on the actual inside diameters.

### Pricing

You pay one low price per request, at the price shown on this page. The chart and report are included. Requests that can't be computed are never charged. If you set a maximum cost per run, the Actor stops before a request that wouldn't fit.

### Speed

A request takes milliseconds. A run through the API answers in about 10 seconds, including the cloud container starting.

### Tips and limits

- **This is a design aid.** Your local code (IPC, UPC or a state amendment), the authority having jurisdiction and the fixture makers have the final word; UPC fixture units and tables differ.
- **Drains** are sized for the total DFU on one pipe. Size each branch with its own fixtures as a separate request. Vent lengths (Table 906.1), sumps, ejectors, indirect wastes and storm drains aren't covered.
- **Water**: meter losses depend on the meter, so give `meter loss 5 psi` (0 otherwise); high-demand fixtures (fire sprinklers, irrigation, commercial equipment) need their own gpm added.
- **Limits**: 200 requests per run.

### For AI agents and developers

This Actor works with the [Apify MCP server](https://mcp.apify.com), so AI agents can call it as a tool. Pass `requests` as plain text and read `summary`, `pipeSizes`, `drainSizes` and `warnings`. A direct API call that waits for the answer:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~plumbing-calculator/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"requests": ["3 bathrooms, kitchen sink, dishwasher, clothes washer, PEX, 55 psi, 100 ft developed length"]}'
```

`run-sync` instead returns the run's `OUTPUT`: the status, the counts and every result as JSON.

In Python, with the `apify-client` package:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("jumblemog/plumbing-calculator").call(run_input={
    "requests": [{"fixtures": {"water closet": 6, "lavatory": 6, "urinal": 2}, "occupancy": "public", "flushValve": True}],
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["summary"])
```

### Credits

- Method: the International Plumbing Code 2021 (International Code Council): Tables 709.1, 710.1(1), 710.1(2), 604.3 and 604.5, and Appendix E. This Actor is not affiliated with the ICC.
- Charts: [Vega-Lite](https://vega.github.io/vega-lite/) and [vl-convert](https://github.com/vega/vl-convert) (BSD-3-Clause), with the [Inter](https://rsms.me/inter/) font (SIL Open Font License).

# Actor input Schema

## `requests` (type: `array`):

One job per entry, as a line of text or an object. List the fixtures with counts ('2 bathrooms', '2.5 baths', 'half bath', 'kitchen sink', 'dishwasher', 'clothes washer', 'laundry tray', '3 lavatories', 'water closets', 'urinals', 'showers', 'bathtub', 'floor drain', 'hose bibbs', 'drinking fountain', 'service sink', 'bar sink', 'bidet') or give '45 WSFU' or '120 DFU'. Say 'water supply' or 'drainage' for one side only (both by default). Options: 'public' (restrooms, offices), 'flush valves', 'PEX' / 'CPVC' / 'type K copper' / 'PVC' / 'galvanized' (type L copper by default), '60 psi' street pressure, '20 ft elevation' or '3-story', '120 ft developed length', 'meter loss 5 psi', 'fittings 30%', 'min pressure 15 psi', 'max 6 ft/s', and the drain slope '1/8 in per ft'. One pipe: '12 gpm through 3/4 in PEX, 80 ft' or '25 gpm copper' (the size that stays under 8 ft/s). Object fields: type (supply, drain, both or pipe), fixtures, dfu, wsfu, occupancy, flushValve, oldToilets, material, pressure, minPressure, meterLoss, elevation, stories, length, fittings, maxVelocity, slope, flow, size, title, text.

## `material` (type: `string`):

For requests that don't name one (copper type L if left empty).

## `occupancy` (type: `string`):

Which fixture unit values to use when a request doesn't say (private if left empty).

## `charts` (type: `boolean`):

Fixture units by fixture, the velocity in each pipe size, drain capacity by size, or a pipe's friction against flow.

## Actor input object example

```json
{
  "requests": [
    "2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs",
    "water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length",
    "drainage for 3 bathroom groups, kitchen sink, clothes washer, laundry tray, floor drain, 1/8 in per ft",
    "public restroom water supply: 4 water closets with flush valves, 3 urinals, 4 lavatories, drinking fountain, 55 psi, meter loss 6 psi, length 150 ft",
    "12 gpm through 3/4 in PEX, 80 ft",
    {
      "type": "drain",
      "dfu": 120,
      "slope": "1/4"
    }
  ],
  "charts": true
}
```

# Actor output Schema

## `results` (type: `string`):

One row per request: the summary and chart.

## `output` (type: `string`):

The OUTPUT record: every result in one JSON object.

## `files` (type: `string`):

Charts (PNG and SVG) and Markdown reports in the run's key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "requests": [
        "2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs",
        "water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length",
        "drainage for 3 bathroom groups, kitchen sink, clothes washer, laundry tray, floor drain, 1/8 in per ft",
        "public restroom water supply: 4 water closets with flush valves, 3 urinals, 4 lavatories, drinking fountain, 55 psi, meter loss 6 psi, length 150 ft",
        "12 gpm through 3/4 in PEX, 80 ft",
        {
            "type": "drain",
            "dfu": 120,
            "slope": "1/4"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("jumblemog/plumbing-calculator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "requests": [
        "2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs",
        "water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length",
        "drainage for 3 bathroom groups, kitchen sink, clothes washer, laundry tray, floor drain, 1/8 in per ft",
        "public restroom water supply: 4 water closets with flush valves, 3 urinals, 4 lavatories, drinking fountain, 55 psi, meter loss 6 psi, length 150 ft",
        "12 gpm through 3/4 in PEX, 80 ft",
        {
            "type": "drain",
            "dfu": 120,
            "slope": "1/4",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("jumblemog/plumbing-calculator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "requests": [
    "2 bathrooms, kitchen sink, dishwasher, clothes washer, 2 hose bibbs",
    "water supply for 2.5 baths, kitchen sink, dishwasher, clothes washer, PEX, 60 psi, 20 ft elevation, 120 ft developed length",
    "drainage for 3 bathroom groups, kitchen sink, clothes washer, laundry tray, floor drain, 1/8 in per ft",
    "public restroom water supply: 4 water closets with flush valves, 3 urinals, 4 lavatories, drinking fountain, 55 psi, meter loss 6 psi, length 150 ft",
    "12 gpm through 3/4 in PEX, 80 ft",
    {
      "type": "drain",
      "dfu": 120,
      "slope": "1/4"
    }
  ]
}' |
apify call jumblemog/plumbing-calculator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jumblemog/plumbing-calculator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/D7zw9FPfRkRY8EkwB/builds/e9mPSwG6ak2Bm93cZ/openapi.json
