What Is a Symmetric Difference in GIS?
Symmetric difference (also called XOR, or exclusive or) is a vector overlay operation that keeps only the parts of two polygon layers that do not overlap, discarding the shared area entirely. Anywhere you need to find what changed between two boundaries, whether that's an old zoning line against a new one, or two coverage areas you want to compare, this tool answers it. This tool runs the full calculation locally in your browser: draw two shapes directly on the map, or upload a GeoJSON file or a zipped Shapefile, and it works as a self-contained GeoJSON and Shapefile symmetric difference tool without sending your data anywhere. The map itself loads with no basemap by default, so the tool starts fast and light; switch a basemap on from the sidebar only if you want street or satellite context underneath your layers.
How to Add Your Polygon Layers
There are two ways to get polygons into the tool before running a symmetric difference, and both accept GeoJSON or a zipped Shapefile:
- Draw on the map: Click "Draw Polygon", click the map to place corners, then double-click, press Enter, or click Finish to close the shape. Repeat to add a second polygon.
- Upload a file: Drag and drop a .geojson file or a zipped Shapefile (.zip with .shp/.dbf/.shx inside) anywhere on the map, or use the Upload button. Only Polygon and MultiPolygon features are read in; points and lines are skipped.
Once you have at least two polygon layers, pick one as Layer A and the other as Layer B in the sidebar, then click "Find Symmetric Difference" to keep only the area where they don't overlap.
How the Symmetric Difference Algorithm Works
Symmetric difference has a simple set-theory definition: it's every point that belongs to Polygon A or Polygon B, but not to both. Written as a formula, A ⊕ B = (A ∪ B) − (A ∩ B), the union of the two shapes minus their intersection. There's a second, equivalent way to write the same operation that is actually easier to compute reliably: A ⊕ B = (A − B) ∪ (B − A), the parts of A with B erased, combined with the parts of B with A erased. This tool uses the second form.
That choice matters because computing a full union first and then subtracting an intersection from it means running two separate boolean overlay operations back to back, and any rounding error in the first one propagates into the second. Running two independent difference operations instead, one for A minus B and one for B minus A, and simply placing both results in the same output layer, needs no shared intermediate geometry at all, and each half can fail independently without breaking the other. If a real-world dataset has one badly formed ring, this tool still returns whichever half succeeded, tagged so you know which is which.
The Pipeline This Tool Runs
- Dissolve each input layer: If a layer has more than one feature, every polygon inside it is merged into a single geometry first with a boolean union, so the layer behaves as one shape rather than a list of separate parts.
- Run A minus B: The dissolved Layer A geometry and the dissolved Layer B geometry are passed to the same sweep-line boolean difference algorithm this site's Polygon Difference Tool uses, keeping only the part of A that falls outside B.
- Run B minus A: The same algorithm runs a second time with the layers swapped, keeping only the part of B that falls outside A.
- Tag and combine both halves: Each surviving piece is labelled A only or B only in its properties and placed into one output layer, so the result always shows exactly where the two inputs disagree.
- Total the exclusive area: The area of every output feature is summed with a spherical area formula and shown in hectares, square kilometres and acres, so you get a number as well as a shape.
Each of the two difference passes is itself a Martinez–Rueda-style sweep-line boolean clipping algorithm: it sorts every edge endpoint left to right, sweeps a vertical line across the data, and classifies every resulting segment as inside or outside the other polygon using winding rules, the exact same engine and the exact same math this site's Polygon Intersection and Polygon Difference tools use. Symmetric difference doesn't need a new clipping algorithm, it just needs the existing one called twice with the operands swapped.
Real-World Use Cases
Frequently Asked Questions
Exporting Your Results
Every layer can be exported independently, or you can export everything at once:
- Single layer export: The download icon next to any layer exports just that layer's features as a standalone .geojson file.
- Export everything: The "Download All Layers" button combines Layer A, Layer B, and the symmetric difference result into a single GeoJSON FeatureCollection, tagging each feature with which layer it came from.
- GeoJSON format: Output files are standard RFC 7946 GeoJSON, which opens directly in QGIS, ArcGIS, Google Earth, Mapbox, and virtually every other GIS tool.
Because the output is plain GeoJSON, it re-imports cleanly into this same tool later, or into any GeoJSON or Shapefile workflow you run afterward in desktop GIS software.
Step-by-Step: Finding a Symmetric Difference





The GIS Libraries Behind Symmetric Difference
Symmetric difference is common enough that most GIS software ships it as a single named tool, even though under the hood it's almost always built from the same union and difference primitives this page just described.
- Turf.js (difference + union): This tool's own engine. Turf.js has no single symmetricDifference function, so this tool calls @turf/difference twice and @turf/union for dissolving multi-feature layers, all running as pure JavaScript directly in your browser tab.
- PostGIS ST_SymDifference: PostgreSQL's spatial extension ships ST_SymDifference as a single SQL function, backed by the GEOS library, the same C++ engine that computes ST_Intersection and ST_Difference.
- QGIS Symmetrical Difference: QGIS's Processing Toolbox has a dedicated "Symmetrical Difference" algorithm under Vector Overlay, which also calls GEOS underneath the user interface.
- ArcGIS Symmetrical Difference: Esri's ArcGIS Pro ships a Symmetrical Difference geoprocessing tool with the same input-two-layers, get-the-XOR behaviour, implemented with Esri's own geometry engine rather than GEOS.
- Shapely (symmetric_difference): Python's Shapely library exposes a .symmetric_difference() method directly on its geometry objects, which, like everything else in Shapely, delegates to GEOS underneath.
All five tools agree on the same underlying mathematics, since symmetric difference has exactly one correct answer for a given pair of geometries. The practical difference, as with this site's other overlay tools, is where the computation runs: GEOS-based tools need PostgreSQL, QGIS or a Python environment installed, while this tool's Turf.js engine runs as a map polygon XOR finder directly on your device, so no file is ever uploaded anywhere.
Managing Multiple Layers
The sidebar layer manager keeps every polygon layer you add, plus every symmetric difference result you generate, in one list. You can run the tool more than once with different layer pairs, keep every result on the map at the same time, and delete any layer you no longer need without affecting the others, useful when checking how several candidate boundaries all differ from one base layer in turn.
Styling Your Layers
Every layer, including the result, can be restyled independently, and the basemap itself is entirely optional:
- Color picker: Click the color swatch next to any layer in the sidebar to change its fill and outline color instantly.
- Visibility toggle: Uncheck a layer to hide it on the map without deleting it, useful when comparing Layer A and Layer B against the result on their own.
- Basemap toggle: The map loads with no basemap by default so the tool stays fast and the focus stays on your shapes. Check "Show basemap" in the sidebar at any point to add a Street or Satellite basemap underneath your layers, and switch it off again just as easily.
None of this styling is saved anywhere outside your session, it only controls how the map looks while you work.
Related Geoprocessing Tools
Map tiles © OpenStreetMap contributors and Protomaps (hosted by KONAKTIVE), CARTO, Esri (satellite, opt-in). Symmetric difference math powered by Turf.js. Shapefile parsing by shpjs. Map rendering by Leaflet. All drawing, file reading and calculation is local, no data is uploaded to any server.
