How the districts are drawn
Every map in this viewer comes from 2020 Census counts and three fixed steps: cut, keep blocks whole, balance. Here is each stage in plain language, with a drawing. Numbers in the drawings are examples unless they name a state. The maps cover the 50 states. Washington, D.C. and the U.S. territories are not drawn. They elect non-voting delegates to the House, and their local legislatures are not covered.
What goes in
Three facts about each census block go in, plus each chamber’s district count in each state. Nothing else does.
Goes in
- how many people the census counted there
- where its edges are
- one point inside it, used to put blocks in order and to measure island links
Plus one number per state and chamber: its House seats from the 2020 apportionment, or its number of State House or State Senate districts.
Never goes in
- party registration or voter records
- election results or turnout
- where officeholders or candidates live
- the shapes of current or past district lines (for a State House or State Senate map, only the number of districts in the Census Bureau’s file is used)
- race, ethnicity, age, income or anything else about people besides the count
- county and city lines
The generator works from the 2020 Census, one census block at a time. A census block is the smallest area the Census Bureau counts people in: an area bounded by features such as streets, streams and railroad tracks, or by lines such as city and property limits. Every person in the country is counted in exactly one block. For every block in a state it reads three things:
- the number of people counted in the block,
- the block’s shape on the ground, and
- the block’s internal point, a point inside the block that the Census Bureau publishes (
INTPTLAT20andINTPTLON20). It is used to put blocks in order across a guide line and to measure island links.
Current district lines are shown on the map for comparison only. The generator never reads their shapes; for a state chamber it reads the current district files only to count how many districts to draw. County and city boundaries are not used to draw anything. Counties are only counted afterwards, for reporting. People are counted where the census counted them, with no adjustments, so a person in a prison is counted at the prison.
The number of districts in a Federal House map is the number of House seats the state received in the 2020 apportionment. The number of districts in a State House or State Senate map is the number of distinct districts in the Census Bureau’s 2025 state legislative district file for that chamber. Nebraska has one chamber, so it has no State House map. Each chamber is drawn separately, by the same rule.
One cut
Each cut splits a piece of the state in two. The line is placed so that each side holds its share of the seats and of the people, and each side must be one connected piece. Of all the straight lines that do both, the one with the shortest border is used.
Start with the whole state. A piece with some number of seats is split into two sides that hold as close to half the seats each as possible: a piece with 7 seats is split 3 and 4, a piece with 2 seats is split 1 and 1.
To find the line, the generator considers a straight guide line in every direction. Each line is placed so the people on one side match that side’s share of the seats.
Every straight line, checked once
There are endlessly many directions, but the split can change only at certain angles: the ones where the line runs parallel to the segment between two blocks’ internal points. Between two such angles every direction gives the same two sides. The generator finds those angles, then checks each stretch between them once. That covers every direction, with none skipped.
Blocks stay whole
A census block is never split: the census counts people only per block, so there is no count for part of a block. Each block goes, whole, to the side its internal point is on. So the guide line only decides which side each block joins, and the real border follows block edges.
The shortest border wins
Every guide line becomes a real border, and the generator measures its length. First, any stray pieces join the side around them and the line slides so the people still split evenly (the next stage). Then each side must be one connected piece. Of the lines that pass, the one with the shortest real border is used.
How the winning line is chosen
- Put the blocks in order. Take one direction. Line up the piece’s blocks by where their internal points sit across a line in that direction, from one edge of the piece to the other.
- Walk until the first side has its share. Go along that order adding up people. Find the block that takes the running total to the first side’s share or past it. Stop just before that block or just after it, whichever leaves the total closer to the share. If both are exactly equally close, both stopping points are kept as candidates, and the tie rules below choose between them.
- Settle the stray pieces. Pieces cut off from their side join the side around them, and the line slides so the people still split evenly (the next stage).
- Repeat for every stretch of directions. Do the same for each stretch between the angles where the split changes, so every straight line is covered.
- Measure the real borders. For each stretch, measure the border along block edges that it makes.
- The shortest border wins. The shortest border whose two sides are each one connected piece is used. If two different cuts have exactly the same border length, the one whose sides are nearer their fair shares of people wins, and then GEOID decides (see the exact rules below).
A worked example: placing one line
Example numbers: a piece with 2 seats and 1,000 people, so the first side’s share is half, 500 people. For one direction, its eight blocks are already in order across the line.
| Block | People | Running total |
|---|---|---|
| A | 120 | 120 |
| B | 90 | 210 |
| C | 160 | 370 |
| D | 70 | 440 |
| Epasses the share | 100 | 540 |
| F | 130 | 670 |
| G | 150 | 820 |
| H | 180 | 1,000 |
The running total passes 500 at block E. Stopping just before E leaves 440 people, 60 short. Stopping just after it gives 540, 40 over. 40 is closer, so the walk stops after E: blocks A to E (540 people) form one side, and F to H (460 people) the other. Had both been exactly equally close, both stopping points would have been kept as candidates, and the tie rules would have chosen between them.
Comparing directions
That walk places one line. It is repeated for every stretch of directions, and each gets its real border measured. The drawing shows three of them.
The exact rule
- Both ways of splitting the seats. When the two shares differ (an odd number of seats), the whole half turn is swept twice, once with the smaller share on each side of the line, and each sweep has its own stretches.
- Straight on a globe. A straight line here is a great circle, the path a plane through the center of the Earth traces on its surface. The directions are measured in a flat projection centered on the state, in which every great circle is a straight line.
- Putting blocks in order. The blocks are ordered by how far their internal points sit across the line. The generator walks along that order, adding up people, until the first side holds as close to its share as whole blocks allow. Two blocks sit at exactly the same distance only at the one direction where they swap places, and every stretch is checked between such directions. Blocks whose internal points coincide are taken in GEOID order, the census block identifier, so the order is always the same.
- Measuring the border. The length is the total of the block edges with one side on each hand, measured along the surface of the Earth. The census gives each block’s outline as corner points in longitude and latitude, not lengths, so each straight stretch between two corner points is measured as the shortest path over a sphere the size of the Earth (radius 6,371,008.8 m). The stretches two blocks share are added into one length for that pair, stored as a whole number of micrometers, and the border is the sum over every pair split by the line. Whole numbers add up exactly in any order, so the same border always gets exactly the same length. The census gives block outlines to about 11 cm (six decimal places of a degree). Lengths are kept in whole micrometers only so that adding them up always gives exactly the same total; that unit is far finer than the outlines themselves. Water inside the state counts as part of the state, so a bay or a lake does not shorten or break a border.
- The share. The first side’s share is the piece’s population times the first side’s seats, divided by the piece’s seats. It need not be a whole number: 3 seats split 1 and 2 with 1,000 people make a share of 333⅓.
- Where the walk stops. The walk stops at the first block that brings the running total to the share or past it. If the total after that block is strictly closer to the share than the total before it, the block joins the first side. If the total before it is strictly closer, the block starts the second side. If the two are exactly equally close, or an empty block sits next to a side that is exactly on its share, walking the order from one end and walking it from the other end can stop in different places. Both are kept as candidates, and the tie rules below choose between them. The generator walks from the other end only where such a tie happens. Each side always keeps at least one block.
- The order of the checks. Every stretch’s line is first settled for stray pieces, with its re-counts (the next stage), and its real border is measured after that. The borders are compared by length, and the shortest whose two sides are each one connected piece is used.
- Ties. Lengths are compared exactly as stored, so any shorter border wins, and two borders are tied only when their stored lengths are exactly equal. Usually that means two stretches that give the same two sides, which are one cut, so nothing is decided. If two different cuts ever had exactly equal borders, two rules would decide in turn. First, the cut whose first side holds a number of people nearer its fair share is used (the piece’s people times the first side’s seats, divided by the piece’s seats; the distance is the same measured from the second side). If that is exactly equal too, GEOID decides: take the block with the lowest GEOID in the piece, find the lowest GEOID among the blocks the two cuts put on different sides, and use the cut that puts that block on the same side as the piece’s lowest GEOID. Exact ties between different cuts are rare on real census lengths. The line drawn on the map is the middle of the first stretch giving the chosen cut, going clockwise from north. That is a choice about where to draw the line, not a rule for choosing the cut.
Stray pieces and the re-count
Because blocks stay whole, a large block that straddles the guide line can leave a smaller block cut off from the rest of its side. A block, or a group of blocks, cut off like this is a stray piece.
A stray piece joins the side around it and stays there for the rest of that cut. Then the people are counted again, including the pieces that moved, and the line slides so the two sides still hold their shares. If the slide cuts off a new piece, that piece joins the side around it too, and the count is done again. This repeats until nothing is cut off.
A worked example: one re-count
Example numbers: a piece with 2 seats and 1,000 people, so each side’s share is 500.
Big stray pieces are allowed
There is no limit on how many people a stray piece holds. A line that cuts off a big region still has to win on border length, like every other line, and its border is measured after the strays have joined and the line has slid. Here the line across both arms cuts off 41,000 people and is allowed, but its border, 35 km, is longer than the 30 km of a line that cuts off nobody. The stray piece itself adds no border; the extra length comes from the slid line crossing the wide right arm.
A cut is also used only if both of its sides are each one connected piece.
The exact rule
- Which group stays. On each side, every connected group of blocks other than the side’s main body joins the other side, the side around it. The main body is the group with the most people; if two groups have exactly as many, the one holding the lower GEOID. Each round settles first the side that holds the piece’s lowest GEOID, then the other side, and this repeats until nothing moves.
- Moved pieces are fixed. A block that moves is fixed to its new side at once. It never moves again during that cut: not in a later pass, and not after a re-count. Fixed blocks count toward their side’s groups like any other block. If a group cut off from its side’s main body contains fixed blocks, its free blocks still join the other side, and its fixed blocks stay where they are.
- The re-count. The walk from stage 2 is done again over the free blocks only, in the same order. The fixed blocks’ people already count on their sides, so the first side’s target is its share minus the people fixed on it. The stopping rule is the same: the closer total, with both stopping points kept as candidates when they are exactly equally close. A side with no fixed blocks keeps at least one free block. The line is placed between the last free block of the first side and the first free block of the second.
- When it ends. Stray pieces are settled and the people re-counted until a pass moves no free block. Every re-count follows at least one newly fixed block, and fixed blocks never become free, so a piece of m blocks needs at most m walks.
- A piece that cannot rejoin. If a pass moves nothing but a fixed piece is still cut off from its side, it cannot move back. That line’s sides are not each one connected piece, so it fails the check that each side is one connected piece, and the next shortest line is considered. This is the only way a shorter line loses to a longer one, so the line used is not always the shortest line tried.
- Crossing the outline. A line may cross the piece’s outline any number of times.
- Connected. Two blocks are connected when they share an edge; touching at a single corner does not count. Census blocks cover lakes, bays and coastal water, and a water block is a block like any other. Land on two shores is therefore connected when blocks of the same district, water blocks included, join them.
- Islands. Land that no block reaches, even across water, is connected the way cuts are chosen: of every possible link from the connected land to a detached piece, measured between internal points, the shortest is added, and this repeats until every piece is connected. If two links are exactly the same length, the one between the blocks that come first in GEOID order is added. A link counts toward connection only when both of its ends are on the same side of a cut, and when the two sides of a cut meet across a link, the link’s length is added to that cut’s border. A link often goes to another island rather than the mainland, so a state with islands can still be cut. The map draws these links as dashed lines. Keep in mind that a link joins pieces, not single islands: the Census Bureau sometimes draws one block around a cluster of small islands, and those islands are already one block, so no link is drawn between them. To see this, click a district to select it and zoom in. Zoomed in, the map is drawn block by block, and the selected district’s links stay on screen as dashed lines.
Repeat until every piece has one seat
Each side of a cut is cut again in the same way, and so on, until every piece has exactly one seat. Each piece then becomes one district. The side holding the piece’s lowest GEOID gets the lower district numbers.
A state with N seats takes exactly N minus 1 cuts. Each piece is cut on its own, so the order in which pieces are handled does not change the result.
Following one state: Colorado
Loading Colorado’s cuts…
Balancing, and why it is needed
U.S. House districts must be as nearly equal in population as practicable. That is the standard the Supreme Court applied to congressional districts in Karcher v. Daggett (1983). State legislative districts are usually allowed more variation in law, but these maps hold every chamber to the same standard: as equal as whole blocks allow. Each cut stops at the block that brings its sides closest to their shares, but whole blocks rarely land exactly on a share, and the small differences add up across many cuts.
So after the cuts, the districts are close to equal but not exactly. To finish the job, districts trade single blocks along their shared borders, one at a time. A trade is only made if it brings the two districts closer to equal (or leaves them exactly as close and shortens the border) and keeps both in one piece. A cut ranks by border first, then people. Balancing is the opposite: people first, then border. When no trade helps any more, it stops.
How the next block is chosen
- Find the district furthest from the ideal. Distance is counted from the ideal population, so 400 people over and 400 people under are equally far. If two districts are equally far, the one whose first block comes first in GEOID order goes first.
- List every single-block trade involving it. That means each of its own blocks that touches a neighboring district, moving out to that neighbor, and each neighbor’s block that touches it, moving in. A trade may be made only if it brings the two districts closer to equal population, or leaves them exactly as close and shortens the total border. A block with no people never changes a population, so it trades only when that shortens the border.
- Score each trade. The score is how much the trade brings the whole state closer to even, measured as the sum of squared distances from the ideal: square each district’s distance and add them up. Squaring makes a big miss count far more than a small one. One district 400 off adds 160,000; four districts 100 off add only 40,000 between them. A trade that raises the sum is dropped. A trade that leaves it the same scores zero, comes after every trade that lowers it, and is kept only if it shortens the total border. A block with no people is always such a trade, since moving it changes no population.
- Take the best trade that keeps the giving district in one piece. If two trades score the same, the one that leaves the shorter total border wins, then the block that comes first in GEOID order.
- Start over. Go back to step 1 with the new populations. If the furthest district has no trade allowed, try the next furthest.
- Stop when no trade helps anywhere.
A worked example: one move
Example numbers: District 3 is 400 people above an even split, District 1 is 300 below and District 5 is 100 below. Every other district is already even. The sum of squares is 400² + 300² + 100² = 260,000.
District 3 is furthest off, so its trades are listed. Moving any block into District 3 would push it further over, so those trades make the sum bigger and are dropped. Three trades are left.
| Trade | District 1 | District 3 | District 5 | Sum of squares | Better by |
|---|---|---|---|---|---|
| Before any trade | −300 | +400 | −100 | 260,000 | – |
| A: 250 people to District 1 | −50 | +150 | −100 | 35,000 | 225,000 |
| B: 300 people to District 1chosen | 0 | +100 | −100 | 20,000 | 240,000 |
| C: 120 people to District 5 | −300 | +280 | +20 | 168,800 | 91,200 |
Trade B wins: it leaves the state closest to even overall, a sum of 20,000. Trade A also helps a lot, but leaves District 3 150 over. Trade C leaves District 1 300 short.
Then the process starts over from whichever district is now furthest off. After trade B, District 3 is 100 over and District 5 is 100 under. They are equally far, so the tie goes to the district whose first block comes first in GEOID order, and the next round starts from District 5.
In the replay, each move is one of these choices; the readout shows the block, its people, and the two districts’ new gap.
The exact rule
The pass makes one move at a time. The ideal is the state’s population divided by its number of seats. People come whole, so an even split puts each district at the ideal rounded down or up. For example, Missouri’s 6,154,913 people and 8 seats make an ideal of 769,364.125, so an even split is 769,364 or 769,365 people. The viewer shows how far each district is from an even split, in whole people.
- Start with the district whose population is furthest from the ideal, measured as the absolute difference. A tie goes to the district whose first block comes first in GEOID order.
- Look at the blocks along its border: its own blocks that touch a neighboring district, and the neighbors’ blocks that touch it. A block may move to the district on the other side only if the move brings the two districts closer to equal, or leaves them exactly as close and shortens the total border. In both cases the district it leaves stays one connected piece. The district it joins stays connected too, because the block touches it.
- Of the moves allowed, make the one that brings the districts closest to equal overall, measured as the sum of the squared differences between each district’s population and the ideal. Only the two districts in a move change, so moving p people from a district a people above the ideal to one b people above it (a negative number when below) lowers the sum by exactly 2 × p × (a − b − p). That is above zero exactly when the two districts end up closer to equal. A move that leaves them exactly as close changes the sum by nothing, so it ranks after every move that lowers it, and is allowed only when it shortens the border. A block with no people is always such a move. A tie goes to the trade that leaves the shorter total border: the length the block shares with the district it leaves minus the length it shares with the district it joins. Like a cut’s border, it is measured in whole micrometers, from the same stored length for each pair of neighbors, so it is compared exactly. A further tie goes to the block that comes first in GEOID order, then to the receiving district whose first block comes first in GEOID order. A move that would leave the giving district with no blocks is never made.
- If that district has no allowed move, try the next furthest. After every move, start again from the district now furthest from the ideal.
- Stop when no move helps. Every move either lowers the sum of the squared differences or leaves it the same and shortens the total border. Neither can go below zero, so the pass always stops.
In the real states
Loading the numbers for each state…
Same data, same map
Run the generator again on the same data and you get the same map, down to the last block. There are no random numbers and no seed, and nobody chooses a starting point or a preferred outcome.
The map itself is a file that lists every block and the district it belongs to. Its fingerprint is a 64-character code worked out from that file. The code changes completely if even one block is assigned differently, so two people can compare that one value to confirm they got the same map. Each map’s fingerprint is printed under “Check this map” in its view.
The exact rule
Blocks are always processed in GEOID order. Given the same census files, the generator writes a byte-identical assignment file and identical district shapes on any computer. No cut depends on a computed angle; the angles shown are worked out by the generator’s own code, so they match everywhere too. The fingerprint is the SHA-256 hash of that assignment file.
To reproduce a state’s map
The generator, this viewer and the published data are all in the project’s GitHub repository. Get the code and run it:
git clone https://github.com/mels0n/str-redistricting
cd str-redistricting
npm install
npm run explore -- --states COEvery map names the engine and Census input version that drew it. Same versions, same districts, every time. See what changed in each release on the changelog page.
The state is given by its two-letter abbreviation. Add --chamber state-house or --chamber state-senate for a state chamber. The census block file for the state is downloaded from the U.S. Census Bureau the first time it is needed.
Data sources and limits
- 2020 Census blocks, from the U.S. Census Bureau: people, shapes and internal points. With the number of districts in each chamber, the only data that draws the maps.
- 119th Congress districts, from the Census Bureau’s cartographic boundary file
cb_2025_us_cd119_500k. Shown for comparison only and never read by the generator. A state that adopted a new map after that file was made is not reflected in it. - State legislative districts, from the Census Bureau’s cartographic boundary files for state legislative districts (2025),
cb_2025_<fips>_sldl_500kandcb_2025_<fips>_sldu_500k. Used only for the number of districts in each state chamber and for the comparison lines. The generator never reads their shapes. - State outlines and county names, from the Census Bureau’s cartographic boundary files. Used for display and for counting the counties a district touches. The state outlines clipped to the shoreline (
cb_2020_us_state_500k) also show where land ends and water begins. - Address search uses the U.S. Census Bureau geocoder. The address you type is sent to that service.
Limits
- Zoomed out, district shapes are simplified so the maps load quickly. Zoomed in, they are drawn block by block. The numbers, and the file that assigns every block to a district, are never simplified.
- The maps are drawn from census blocks, and census blocks include water: they run out to the state’s legal boundary, across lakes, bays and coastal water. Each district therefore covers the water inside its edge, and that water is part of the district and counts toward connection. The viewer shows it paler so the land stands out, and shows the selected district’s water in full color. When a district uses an island link, the link appears as a dashed line while that district is selected. None of this changes the districts, the people counted or any number.
- Address search asks the Census Bureau which census block the address is in. When the Census Bureau names the block, address search reads that block’s district from the map file, so the answer is exact. Otherwise it uses the drawn shapes.
Why does a district look strange? How are ties settled? Short answers to common questions are on the FAQ page.