Granny Square Layout Planner
Arranging a pile of finished granny squares is a small puzzle with real limits: there are only so many of each colour, the blanket is a fixed number of squares wide and long, and most people want no two squares of the same colour side by side. This lays out the squares you actually have — counted, never more of a colour than exist — and checks every pair of neighbours afterwards. Keeping matching squares apart can be a preference, in which case the page tells you how many pairs still touch and which ones, or a rule, in which case it shows a layout only if nothing touches. When the rule cannot be met it says whether that has been proved, with the reason, or whether a layout simply was not found. A random arrangement is not assumed to satisfy anything; each one is counted.
What this generator does
Places a fixed inventory of squares on a grid and reports what the arrangement does and does not achieve. The stripe pattern planner decides a sequence before anything is made; this works from what has already been made, so the counts are hard limits rather than targets. The graph colouring challenge sets the general version of the same problem as a puzzle on a drawn network; this is that problem on a blanket, with real counts and a printable joining plan.
How to use this tool
- Set the blanket's rows and columns, in squares.
- List each kind of square — usually a colour or colourway — with how many you have made.
- Choose whether matching squares may touch, should be kept apart, or must be kept apart, and whether corners count as touching.
- Optionally name pairs of colours that should not touch either, and mark orientation if your squares have a direction.
- Press Lay out the squares, then read the counts and the touch report before you start joining.
- Print the labelled grid and the row-by-row list, or download SVG, CSV or JSON.
Understanding the controls
- Rows and columns
- The blanket in squares, up to 20 by 20. The grid must be filled, so the inventory has to hold at least rows times columns squares; any extra are left over and listed as spare.
- Squares you have
- Each kind with a name, a swatch for the picture and a count. The count is a hard limit: no layout ever uses more of a kind than you entered. Every square is also marked with its key letter and cell name, so the printed grid reads in black and white.
- Same kind touching
- Ignore places the squares at random. Prefer apart searches for an arrangement with no matching neighbours and reports however many remain. Require apart shows a layout only if no matching squares touch; otherwise it explains why not.
- Corners count as touching
- Adds the diagonal neighbours to the check, which is much stricter: a square then has up to eight neighbours instead of four, and with four kinds every two-by-two block must hold all four.
- Pairs to keep apart
- Two kinds that should not touch either — two reds that read as the same from a distance, say. They are kept apart under the same preference or rule as matching squares.
- Orientation
- For squares with a direction, such as half-and-half squares. Each square on the plan gets a corner mark showing which way up it goes; alternate turns every other square a quarter turn. Orientation is recorded, not optimised: it never changes where a colour goes.
- Seed (optional)
- The same seed and settings give the same layout again while the generator is unchanged, which is how a layout can be reprinted halfway through joining. A seed repeats a layout; it keeps nothing secret and is not cryptographic.
Worked examples
- 7 by 7 from 12 Rose, 12 Sage, 12 Mustard and 14 Cream, keep apart, edges only — seed cosy
- 49 squares laid out with one Rose left over. All 84 neighbouring pairs were checked and none is two of the same kind.
- The same squares with corners counted — seed cosy
- 156 neighbouring pairs to check, and the best layout found leaves 2 matching pairs, marked on the plan. Required instead of preferred, the page says no layout was found but that this is not proof — the grid is too large to try every arrangement.
- 25 Rose, 12 Sage, 12 Cream on 7 by 7, required apart — seed cosy
- Solved with no matching neighbours. There is exactly one way to place 25 squares of one kind on a 7 by 7 grid without any two sharing an edge — every other square, on the checkerboard colour that includes the four corner squares — and the search finds it.
- 30 Rose, 10 Sage, 10 Cream on 7 by 7, required apart
- Impossible, and said before any search: the other squares can fill only 20 places, so at least 29 Rose have to go down, and at most 25 squares of one kind fit on a 7 by 7 grid without sharing an edge.
Common use cases
- Joining a blanket from squares made over months, where the colour counts are whatever they turned out to be
- A charity or group blanket assembled from squares several people sent in
- Checking whether an inventory can possibly be laid out with no matching neighbours before making more squares
- Quilt or patchwork blocks of a few fabrics, arranged so no two of the same fabric share a seam
- Half-and-half or corner-to-corner squares that need turning, laid out with each one's orientation marked
How this generator works
The request is checked first: the grid has to be fillable from the inventory. With adjacency on, the search starts twice — once from a random fill and once from a fill that lays the kinds out largest first along the squares that cannot touch each other (the two colours of a checkerboard, or the four positions of a two-by-two block when corners count) — and then improves each by trying swaps: two squares on the grid, or a square on the grid for a spare one of another kind. A swap that leaves fewer matching neighbours is kept; one that adds some is occasionally kept too, less often as the search goes on, because tight inventories can only be solved by getting worse first. The better result is kept. When matching squares are required to be apart, two things settle the question honestly. Before any search, a kind that must be used more often than the grid can hold apart (half the squares, rounded up, for edges; a quarter, rounded up each way, with corners) is impossible, and the page says so with the numbers. After the search, a grid of up to 36 squares is tried exhaustively: either a layout turns up or every arrangement has been ruled out, which is a proof. A larger grid that is not solved is reported as not solved, never as impossible. Whatever is shown is then re-checked from the finished grid: every square counted against the inventory, every neighbouring pair compared.
Randomness and fairness
Chance decides the starting fill and which swaps are tried; the counts, the touch report and the impossibility checks are all worked out from the finished grid. Because the search is random, two layouts of the same inventory can differ in how many matching neighbours they leave when the preference cannot be fully met — the report is for the layout in front of you. The draw uses your browser's cryptographic random source, or a repeatable sequence when you type a seed.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- All squares are the same size and join edge to edge in a plain grid, with no sashing or offset rows.
- Squares of the same kind are interchangeable. If two squares of one colour differ in some way you care about, enter them as two kinds.
- A square touches its neighbours above, below, left and right, and its diagonal neighbours only when corners are counted.
Limitations and good to know
- Plain grids of square motifs only, up to 20 by 20. Hexagons, octagons with small fill squares, offset rows and borders are different layouts and are not planned.
- Impossibility is proved only in two ways: a kind that must be used more often than any grid can keep apart, or an exhaustive search of grids up to 36 squares. A larger required layout that is not found is reported as not found.
- It knows nothing about how colours look together. Two kinds that clash, or that look alike, have to be named as a pair to keep apart.
- Orientation is marked on the plan but plays no part in the search, so it never trades off against keeping colours apart.
Common mistakes
- Reading 'not solved' as 'impossible'
- They are different results. Impossible means a reason was found that rules out every layout; not solved means the search ran out on a grid too large to try everything. Try again with another seed, make the rule a preference, or change a count.
- Counting corners as touching with only three or four kinds
- With corners counted every two-by-two block needs four different squares, so three kinds can never satisfy it and four kinds only in a strict alternating pattern. Count edges only, or add kinds.
- Making more of the commonest colour to fill the blanket
- That makes matching neighbours more likely, not less. More than half the squares in one kind cannot be kept apart at all; the page names the limit for your grid.
Practical tips
- Lay the squares out on the floor from the printed plan before joining; a colour that reads differently in daylight is easier to swap then than after.
- Join row by row from the list, ticking each row off, and keep the seed with the plan in case you need it again.
- If one colour dominates, try the preference with corners off first: it is far easier to meet and usually looks just as even from a distance.
Privacy and your data
The layout is worked out entirely in your browser. Nothing you type is stored or sent anywhere: the names of your colours, the counts and the seed stay on this page, and usage counts record only that a layout was made and how many squares it had.
Frequently asked questions
- How many squares of one colour can I have and still keep them apart?
- With edges only, at most half the grid rounded up — 25 on a 7 by 7 blanket, 18 on 6 by 6 — because that is the larger colour of a checkerboard. With corners counted, one square in every two-by-two block: 16 on 7 by 7, 9 on 6 by 6. The page uses those limits to refuse an inventory that cannot work.
- Why did it leave some squares over?
- Because you had more than the grid needs. It chooses which ones to leave out as part of the search, so a spare square is the one that made the layout work best, and the counts table lists what is left of each kind.
- Does every random layout keep the colours apart?
- No, and the page never assumes so. With adjacency ignored, matching squares will often touch. With the preference on, the page counts every touching pair on the layout it shows and marks them; with the rule on, it shows a layout only when that count is zero.
- Can I use this for quilt blocks?
- Yes, for a plain grid of same-size blocks. Enter each fabric or block design as a kind with its count; sashing between blocks does not change which blocks are neighbours.
Related generators
- Stripe Pattern PlannerPlans a striped blanket, scarf, jumper or weaving: stripe widths from the ones you allow, your colours never touching themselves, exact repeats, and the rows, length and yarn each colour needs.
- Graph Colouring Challenge GeneratorColour the nodes so no edge has one colour at both ends, with the greedy answer and — at small sizes — a proof that fewer colours are impossible.
- Colour Palette GeneratorGenerate a real colour palette — six harmony types, with hex, RGB and HSL values and the contrast each colour gives with text.
- Tile Layout CalculatorHow many tiles a floor needs, with the cut pieces shown and a warning when the edge strip is too narrow to look right.