Methodology

How the per-election-district mayoral results on this site are constructed, and what they do and don't represent.

What this is

New York City election district (ED)-level results for the 2017, 2021 and 2025 mayoral general elections and the 2021 and 2025 Democratic mayoral primaries. For the primaries the site shows both first-choice tallies and ranked-choice voting (RCV) final-round tallies. The Board of Elections (BOE) does not publish either of these at the ED level for citywide ranked-choice races; both are computed here from the official Cast Vote Record (CVR) files. The general elections were not ranked-choice races; their results come from BOE's published ED-level results files on vote.nyc and have a single round.

Sources

DataSourceFormat
2021 Democratic primary CVRvote.nycZip of XLSX, 109 MB
2025 Democratic primary CVRvote.nycZip of XLSX, 90 MB
Election district boundaries, 2025 electionsNYC Open Data h2n3-98hq via DCP ArcGIS RESTGeoJSON, 4,247 EDs as downloaded in April 2026 (the live file, updated Aug. 21, 2026, has 4,214)
Election district boundaries, 2021 electionsCity Planning release 21A (February 2021), added by handGeoJSON, 5,839 EDs
Election district boundaries, 2017 electionCity Planning; which release is not recorded; added by handGeoJSON
General election results, 2017, 2021 and 2025BOE ED-level results files (EDLevel CSV) on vote.nycCSV
Candidate ID → name mapIncluded in each year's CVR ZIPXLSX

How results are computed

1. CVR parsing

Each CVR ZIP contains 25–32 XLSX files, one per borough × ballot-channel (election day, absentee, affidavit, early voting, emergency). Each row is one ballot; columns include the ballot's precinct (formatted AD: NN ED: NNN) and one column per (race, choice rank), e.g. DEM Mayor Choice 1 of 5 Citywide. Cell values are either a candidacy ID (integer), undervote, overvote or Write-in.

For each year we extract precinct + the five DEM Mayor choice columns from every file, drop ballots with no DEM Mayor vote in any of the 5 ranks, and parse the precinct string into a single integer ED ID matching the shapefile field ElectDist (= AD × 1000 + ED).

2. First choice

For each ED, count ballots by their Choice 1 candidate (excluding undervotes, overvotes and write-ins, which BOE reports separately). Percentages on the map are share of first-choice votes cast in that ED for a named DEM candidate, not share of all ballots.

3. RCV final round

This site uses the standard citywide-elimination approach — the same approach BOE uses to certify the official final-round tallies. The procedure is:

  1. Restrict the candidate set to "major" candidates — those who received at least 1% of citywide first-choice votes. For 2025 the majors are Mamdani, Cuomo, Lander, Adrienne Adams and Stringer; for 2021 they are Adams, Garcia, Wiley, Yang, Stringer, Donovan, McGuire and Morales.
  2. Run a single citywide instant-runoff elimination on all ballots: repeatedly eliminate the candidate with the fewest active votes citywide, redistributing those ballots to the next non-eliminated choice, until one candidate has a majority or only two remain (the "finalists").
  3. For each ED, count how each ballot would have been allocated at the final round — i.e. each ballot is counted toward the highest-ranked finalist on that ballot. The map's "RCV final" view shows that share per ED.

The 2021 finalists are Eric Adams and Kathryn Garcia. The 2025 finalists are Zohran Mamdani and Andrew Cuomo. In the "RCV final" view, eliminated candidates show 0% in every ED — they did not survive to the final round. To see geographic strength of an eliminated candidate, use the "First choice" view.

4. Geographic join

Each election's results are joined by integer ED ID to a boundary file from its own period, because ED lines changed between these elections: the results list 5,759 EDs for the 2017 general, 5,725 for the 2021 general and 4,117 for the 2025 general. The 2017 general is joined to ed_shapefile_2017.geojson, the 2021 primary and general to ed_shapefile_2021.geojson, and the 2025 primary and general to the current City Planning file that fetch_shapefile.py downloads. The 2017 and 2021 files are older City Planning election district boundaries that were added to data/raw/ by hand; the pipeline does not download them. The 2021 file is City Planning's release 21A (February 2021, 5,839 EDs); the repo does not record which release the 2017 file is. EDs in a boundary file with no results are dropped, as are results with an ED ID not in the boundary file; build_geo.py logs both counts.

What this is not

Reproducibility

All code and normalized intermediates are in github.com/joshgreenman1973/nyc-election-archive. The raw inputs are not; data/raw/ is excluded from the repo. The README's commands download the CVR ZIPs and the current boundary file; the 2017 and 2021 boundary files and the EDLevel CSVs have to be obtained separately. The pipeline is five scripts in data-pipeline/:

Last updated: 2026-04-25.