Knitting gauge calculator
At 5.5 stitches and 7.5 rows per inch, a 20 by 24 inch piece needs 110 cast-on stitches and 180 rows. Enter your swatch gauge and target size in the same unit and start knitting with a plan. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Stitch gauge
- 5.5
- Row gauge
- 7.5
- Target width
- 20
- Desired finished length
- 24
- Cast on
- 110
- Stitches
- 110
- Rows
- 180
- Cast on raw
- 110
A knitting gauge calculator turns your measured stitch-and-row gauge and a finished size into the two numbers every project starts with: stitches to cast on and rows to knit. Enter stitch gauge as stitches per unit of width, row gauge as rows per unit of length, and the target width and length in those same units—inches, centimetres, or any other consistent measure you used on the swatch. The tool multiplies density by size, rounds to whole stitches and whole rows, and returns the raw products plus step-by-step substitution you can check against a paper pattern note. Sweater fronts, scarves, dishcloths, and baby blankets all need that same cast-on and row plan before the first yarn over.
What stitch and row gauge mean for cast-on and rows
Knitting gauge is the density of your fabric: how many stitches fit in one unit of width and how many rows fit in one unit of length after you wash and block a small swatch the way you will treat the finished piece.
Patterns usually quote something like five and a half stitches and seven and a half rows per inch, or twenty-two stitches and thirty rows per ten centimetres; both forms are densities you can feed this calculator once you express them as stitches-per-unit and rows-per-unit in the same unit you will use for the target size. The cast-on count is simply stitch gauge times target width, then rounded to the nearest whole stitch so you can cast on at the needles.
The row count is row gauge times target length, rounded to a whole row so you know when the piece is long enough. Using matching units is essential: if your gauge is per inch, enter width and length in inches; if your gauge is per centimetre, use centimetres for both dimensions.
Teachers and shop classes care about the non-positive gauge rejection as much as the happy path: a zero or negative stitch gauge is not a real fabric density, and silently clamping it would invent cast-on numbers that cannot be knit. The check path recomputes both products with the same fixed rounding used for published fields, so a successful response always ships with steps you can assert in tests, worksheets, or a project notebook before you commit yarn.
Practical tips, units, ease, and related searches
Measure gauge after the same wash and block you plan for the finished fabric; wet gauge and dry gauge often differ, and this tool will faithfully scale whatever density you feed it. Prefer numbers from a full four-inch or ten-centimetre swatch rather than a tiny two-stitch count when you convert to per-unit density, because small counting errors amplify when you multiply by a wide sweater front.
Prefer sending numbers rather than pre-formatted strings when you control the client; string numbers are accepted only when they match a strict finite numeric pattern. Prefer this capability when you already know gauge and finished width and length and only need cast-on and row totals; if your design needs ease, subtract or add ease in the target width before calling.
What you can do with it
Scarf and dishcloth sizing
Crafters enter swatch SPI/RPI and desired width and length to get cast-on stitches and row counts before buying needles or starting a simple rectangle.
Sweater panel planning
Designers scale a measured gauge to front and back panel dimensions so cast-on and length in rows match the intended finished measurements after blocking.
FAQ
How do you calculate cast-on stitches from gauge?
Multiply stitch gauge (stitches per unit width) by the target width in the same unit, then round to the nearest whole stitch.
What if my gauge is written per 10 cm or per 4 inches?
Convert to a per-unit density first (for example 22 stitches per 10 cm becomes 2.2 stitches per cm), then enter target sizes in that unit. The calculator multiplies density by size.
Does this include ease, seams, or cable pull-in?
No. Adjust your target width and length for ease or construction allowances before calling; the solver only scales gauge density to size.
Is the knitting gauge calculator free?
The browser tool is free and runs locally.
How many rows do I knit for 24 inches at 7.5 rows per inch?
180 rows. Multiply the row gauge by the target length and round to a whole row; the same rule gives 110 stitches for 20 inches at 5.5 stitches per inch.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/hobby/knitting-gauge \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"stitch_gauge":5.5,"row_gauge":7.5,"target_width":20,"target_length":24}'const res = await fetch("https://api.kit.forhosting.com/hobby/knitting-gauge", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"stitch_gauge": 5.5,
"row_gauge": 7.5,
"target_width": 20,
"target_length": 24
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/hobby/knitting-gauge",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"stitch_gauge": 5.5,
"row_gauge": 7.5,
"target_width": 20,
"target_length": 24
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/hobby/knitting-gauge", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"stitch_gauge":5.5,"row_gauge":7.5,"target_width":20,"target_length":24}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"stitch_gauge":5.5,"row_gauge":7.5,"target_width":20,"target_length":24}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/hobby/knitting-gauge", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"stitch_gauge": 5.5,
"row_gauge": 7.5,
"target_width": 20,
"target_length": 24
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "hobby.knitting_gauge",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs | 1000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Zero or negative stitch gauge or row gauge is rejected with a clear invalid_input error, because a non-positive density cannot scale a fabric.
How to call the API and what comes back
Every field must be strictly positive; values at or below one times ten to the minus fifteen are treated as non-positive and rejected, which covers the required zero and negative gauge errors as well as empty target sizes. Send a JSON body with four required finite positive numbers: stitch_gauge (aliases stitches_per, sts_per, sts, gauge_stitches, spi), row_gauge (aliases rows_per, rpi, gauge_rows, rows_per_unit), target_width (aliases width, w, desired_width), and target_length (aliases length, height, l, desired_length, target_height). Absolute values must stay within the published limit of one trillion so intermediate products remain finite in IEEE double precision on the Worker and in the browser. On success the response echoes rounded inputs, sets cast_on and stitches to the same rounded integer cast-on count, rows to the rounded row count, cast_on_raw and rows_raw to the unrounded products, formula to a compact summary of the equations, message to a short English summary, and steps to an ordered array of substitution lines. Failed validation—missing fields, non-finite numbers, values outside absolute limits, or non-positive gauge or size—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, units, ease, and related searches
When teaching, pair examples: five point five stitches and seven point five rows per inch for a twenty by twenty-four inch rectangle yields one hundred ten cast-on stitches and one hundred eighty rows; twenty-two stitches and thirty rows per ten centimetres for a fifty by sixty centimetre panel uses stitch_gauge two point two and row_gauge three when width and length are in centimetres; and stitch_gauge zero demonstrates the hard invalid_input path on non-positive gauge. This landing targets people searching for a knitting gauge calculator, cast on from gauge, stitches and rows for target size, or rows per inch planner online; it is not a yarn-yardage estimator, not a needle-size recommender, and not a full pattern generator with shaping. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately set stitch_gauge to zero. Round-trip checks are easy: recompute stitch_gauge times target_width by hand and confirm it equals cast_on_raw within the same twelve-decimal rounding, and confirm that Math.round of that product equals cast_on.
Integration use cases
Unit tests for knitting apps
Hobby apps and education tools generate known-good cast-on and row pairs plus deliberate zero-gauge rejections for deterministic regression fixtures.
Technical questions
What happens when stitch_gauge or row_gauge is zero or negative?
The request is rejected with invalid_input. Non-positive gauge is not a valid fabric density and would not produce a meaningful cast-on or row plan.