A pattern's stitch counts are built for one specific gauge. When your swatch comes out tighter or looser than that gauge, every stitch count in the pattern is technically wrong for your fabric, even though the instructions themselves haven't changed. Rescaling means applying a consistent ratio to the numbers that depend on gauge, and leaving alone the numbers that don't.
The scale ratio
The core relationship is: your actual stitches-per-4-inches divided by the pattern's stated stitches-per-4-inches gives a stitch scale factor. Multiply any gauge-dependent stitch count in the pattern by that factor and round to the nearest whole stitch (or to the nearest multiple, if the stitch pattern requires one, see the stitch-multiple calculator). Row counts get the same treatment using a separate row scale factor, since stitch gauge and row gauge frequently don't match by the same ratio.
Worked example
A pattern calls for 100 stitches at a gauge of 20 stitches per 4 inches. Your swatch measures 22 stitches per 4 inches, tighter than the pattern. The stitch scale factor is 22/20 = 1.1. Multiply: 100 x 1.1 = 110 stitches. Your fabric is denser than the designer's, so you need more stitches to reach the same finished width. If your row gauge came out at 26 rows per 4 inches against a pattern gauge of 24, the row scale factor is 26/24 โ 1.083, applied the same way to any row-count instruction tied to a specific length.
What doesn't scale
Counts that exist for structural reasons rather than sizing, like the number of buttonholes, the repeat count in a stitch pattern, or the number of increase rounds in a specific construction method, generally stay as written. Scaling those would distort the design rather than just the size. The pattern's shaping instructions (like "decrease every 4th row") sometimes need row-scale adjustment too, since a decrease schedule written for one row gauge will hit different points on your fabric if your row gauge differs.
When stitch gauge and row gauge disagree
It's common for stitch gauge to match a pattern closely while row gauge runs off, or the reverse. Stitch gauge usually drives overall width, so it matters most for cast-on counts and horizontal shaping. Row gauge drives length-based shaping like armhole depth and sleeve cap height. Adjusting needle size can pull stitch gauge into line, but changing needle size rarely fixes row gauge by the same amount, since row height responds less predictably to needle size than stitch width does. When the two won't reconcile with a single needle change, scaling row counts directly (rather than chasing an exact row-gauge match) is usually the more reliable fix.