How to Get Screen Coordinates on Windows 11, macOS & For Designers / QA Testing
Finding screen coordinates is not one-size-fits-all. A Windows automation engineer wants physical pixels for AutoHotkey. A macOS designer needs logical points for Figma handoffs. A QA tester has to jump between viewport-relative web coordinates and global monitor coordinates. Below are step-by-step workflows for each platform and role.
Open the Screen Coordinates ToolHow to Get Screen Coordinates on Windows 11
Windows gives you several ways to grab X/Y coordinates. Pick based on whether you need a one-off measurement or continuous tracking.
Method 1: Use the Built-In Screen Coordinates Tool (No Install)
No install — works in any browser.
- Open the Screen Coordinates Tool in Chrome, Edge, or Firefox.
- Press
F11to enter fullscreen mode for the most accurate readings. - Move your mouse anywhere on screen. The X and Y values update in real time.
- Click to lock a coordinate, then copy the values directly into your script or notes.
Pros: No installation, works in any browser, instant live tracking.
Cons: Requires an internet connection.
Method 2: Find Mouse Coordinates with PowerShell
PowerShell can read mouse position via .NET — handy for scripted workflows:
Add-Type -AssemblyName System.Windows.Forms
$pos = [System.Windows.Forms.Cursor]::Position
Write-Output "Mouse X: $($pos.X), Mouse Y: $($pos.Y)"
Run it in PowerShell for an instant readout. Wrap in a loop for continuous tracking.
Method 3: Get Screen Coordinates with AutoHotkey on Windows 11
AutoHotkey shows live coordinates in a few lines:
; AutoHotkey v2: Show mouse coordinates in a tooltip
#Requires AutoHotkey v2.0
#Persistent
SetTimer ShowCoords, 100
ShowCoords() {
MouseGetPos &x, &y
ToolTip "X: " x " Y: " y
}
Save as .ahk and double-click. A tooltip follows your cursor with live X/Y values.
Method 4: Microsoft PowerToys (Power Users)
Microsoft's official PowerToys suite includes a "Screen Ruler" and "Mouse Utilities" that can display live coordinates and measure distances between points.
- Download PowerToys from the Microsoft Store or GitHub.
- Enable the "Mouse Pointer Crosshairs" utility.
- Use the crosshair to align precisely with any pixel and read its position.
Windows 11 DPI Scaling Warning: If your Display Settings show 125% or 150% scaling, browser-based tools and OS-level automation tools may report different numbers. See our technical guide for how to handle DPI scaling correctly.
Windows Multi-Monitor Behavior
Windows treats multiple monitors as a single virtual desktop. The primary monitor holds the (0, 0) origin. Monitors placed to the left produce negative X coordinates; monitors placed above produce negative Y coordinates. Conversely, monitors to the right extend beyond the primary's resolution — a secondary 1080p monitor to the right of a 1080p primary starts at X=1920. You can verify your layout by opening Settings > System > Display and observing how the monitor rectangles are arranged relative to each other.
How to Get Mouse Coordinates on macOS
macOS has built-in coordinate tools, but Retina scaling adds a layer of abstraction that can trip up newcomers — especially those coming from Windows.
Method 1: The Built-in Screenshot Crosshair (Cmd + Shift + 4)
Fastest native method — no install needed.
- Press
Command (⌘) + Shift + 4. - Your cursor becomes a precision crosshair with live X, Y numbers displayed beside it.
- Move to your target location and read the coordinates.
- Press
Escto cancel without saving a screenshot file.
Pros: Instant, native, no network required.
Cons: The numbers are small and hard to read from a distance; you cannot copy-paste the values directly into code.
Method 2: Online Tracker for Copy-Paste Workflows
Need to copy coordinates into a script or log a sequence? A web tool beats squinting at crosshair numbers.
- Open the Screen Coordinates Tool in Safari or Chrome.
- Enter fullscreen mode with
Control + Command + F(works in Safari, Chrome, and Firefox on macOS). - Move your mouse to track and copy exact X/Y positions in real time.
macOS Retina Display Warning
Most modern Macs use Retina displays with a device pixel ratio of 2.0 (or higher on Pro Display XDR). macOS defaults to a "scaled" resolution that looks like 1440 x 900 on a 2880 x 1800 panel. The Cmd+Shift+4 crosshair shows logical point coordinates, not physical pixels.
Good news for automation: PyAutoGUI on macOS works in the same logical point coordinate system. If you get coordinates from Cmd+Shift+4, you can pass them directly to pyautogui.click(x, y) without any conversion — they already match.
# macOS: coordinates from Cmd+Shift+4 work directly with PyAutoGUI
import pyautogui
# No conversion needed — both use logical points
pyautogui.click(720, 450) # matches Cmd+Shift+4 reading
When you DO need the backing scale factor: If you are doing pixel-level image matching on screenshots (OpenCV, template matching), the saved screenshot is rendered at Retina resolution — a 100×100 point selection produces a 200×200 pixel PNG. In that case, multiply image coordinates by backingScaleFactor (usually 2.0) to map from screenshot pixels back to logical points for PyAutoGUI.
To determine your exact backing scale factor programmatically, use NSScreen.main?.backingScaleFactor in Swift, or run system_profiler SPDisplaysDataType | grep "Retina" in Terminal to confirm your display type.
Accessibility Inspector (Developers)
macOS developers can use Accessibility Inspector (bundled with Xcode) to inspect UI element positions in both screen and window coordinates. This is especially useful when writing AppleScript or UI automation tests for native macOS apps.
Screen Coordinates for UI/UX Designers
Pixel-perfect work in Figma, Adobe XD, Sketch, or Photoshop means you need to speak the same coordinate language as developers. Skip the translation in your handoff and implementation mismatches follow.
Concept 1: Artboard vs Global Coordinates
Design tools use a relative coordinate system — this trips up developers if not documented.
- Artboard Coordinates: Inside Figma or Sketch, the top-left corner of your specific Artboard or Frame is always (0, 0). An element positioned at (120, 80) is 120px from the left edge of the Artboard and 80px from the top.
- Global Coordinates: On a physical monitor, the top-left of the entire screen is (0, 0). Our web tool measures global screen coordinates, not Artboard-relative ones.
When handing off specs, always label whether your X/Y values are relative to a parent container, the Artboard, or the global viewport. A common convention is to include a note like: "All coordinates relative to Artboard top-left unless otherwise stated."
Concept 2: Translating X/Y to CSS
Design X and Y values map directly to CSS properties when using absolute positioning:
/* Figma: Element at X=120, Y=80 within a 400x300 container */
.pixel-perfect-element {
position: absolute;
left: 120px; /* corresponds to Figma X */
top: 80px; /* corresponds to Figma Y */
width: 160px; /* Figma width */
height: 40px; /* Figma height */
}
Tip: Use rulers (Cmd+R or Ctrl+R in most design apps) to pull guide lines and check alignment coordinates without selecting every element. Faster than reading the Inspector panel each time.
Concept 3: Spacing Verification with Coordinate Math
Instead of eyeballing whether two buttons are evenly spaced, use coordinates to verify mathematically:
/* If Button A ends at X=200 and Button B starts at X=220,
the gap is 20px. If both buttons are 80px wide and should
have 16px padding, the expected gap is 16px.
220 - 200 = 20px. This is 4px too wide. */
Export your design as a static image, load it into the Screen Coordinates Tool, and hover over edges to confirm spacing values match your design system tokens.
Design QA Workflow
For design QA — verifying that the implemented web page matches the original design — use this workflow:
- Open the staging website and your Figma file side by side.
- Take a screenshot of the web page at exactly the design's target viewport width.
- Overlay the screenshot on top of the Figma frame in a design tool, or use a browser extension like PerfectPixel.
- Use the coordinate tool to measure misalignment at specific elements. Even a 1-2 pixel drift is visible when you know the expected position.
Screen Coordinates for QA Testing & Automation
Testing frameworks like Selenium, Playwright, and Cypress prefer DOM selectors (IDs, data-testids, ARIA labels). Fair enough. But sometimes you need raw coordinates — canvas games, WebGL, drawing apps, legacy desktop wrappers, OS-level macros.
Method 1: Browser DevTools (Web QA)
For web testing, extract coordinates with built-in browser tools — no extra libraries needed.
- Right-click the target element and select Inspect.
- In the Elements panel, the computed box model shows width, height, padding, and margin.
- For precise viewport-relative coordinates, open the Console and run:
// Get the bounding rectangle relative to the viewport const rect = document.querySelector('[data-testid="submit"]').getBoundingClientRect(); console.log(rect.x, rect.y, rect.width, rect.height); // Convert viewport coordinates to document coordinates const docX = rect.x + window.scrollX; const docY = rect.y + window.scrollY;
Important: getBoundingClientRect() returns viewport-relative coordinates (like clientX), not global monitor coordinates. Selenium's ActionChains.move_by_offset and Playwright's mouse.click(x, y) also operate in viewport space. Do not feed coordinates from a fullscreen screen-coordinates tool into Selenium or Playwright — you must account for the browser's tab bar, address bar, and bookmarks bar offset. Use getBoundingClientRect() directly in the browser console instead.
Method 2: Desktop Automation with Global Coordinates
Testing non-web apps or using PyAutoGUI / AutoHotkey? You need absolute global coordinates.
- Open the Screen Coordinates Tool in fullscreen mode.
- Move your mouse over the application area you are testing.
- Record the X and Y values.
- Input them into your automation script:
import pyautogui # Ensure DPI awareness on Windows first # (see the technical guide for details) pyautogui.click(x=840, y=620) pyautogui.sleep(0.5) pyautogui.typewrite("Test input", interval=0.01)
Method 3: Screenshot-Based Regression Testing
For visual regression testing, coordinates are used to define "ignore regions" (areas that change intentionally, like timestamps) or "diff hotspots" (areas that must remain pixel-identical).
// Playwright example: pixel-perfect visual comparison
// with an ignore region for the clock area
await expect(page).toHaveScreenshot('dashboard.png', {
clip: { x: 0, y: 0, width: 1280, height: 720 },
// Some tools allow masking specific coordinate ranges
});
Viewport vs Screen: A Decision Framework
| Coordinate Type | Origin | Used By | When You Need It |
|---|---|---|---|
| Viewport (clientX/clientY) | Top-left of browser window | Selenium, Playwright, Cypress | Web element interaction, responsive testing |
| Document (pageX/pageY) | Top-left of full HTML document | JavaScript event handlers | Scrolling-aware elements, infinite scroll |
| Screen (screenX/screenY) | Top-left of primary monitor | PyAutoGUI, AutoHotkey, AppleScript | OS-level macros, cross-application workflows |
QA Best Practices
- Prefer DOM selectors over coordinates. Only use coordinates when the target has no stable selector (canvas, WebGL, video overlays).
- Record coordinates at the target viewport size. Responsive layouts shift element positions at different breakpoints.
- Account for OS scaling. A test that passes on a 100% scaling developer machine may fail on a 125% scaling CI runner. See our technical guide for platform-specific fixes.
- Document coordinate assumptions. Include a README in your test suite that states the expected screen resolution, browser zoom level, and OS scaling for coordinate-based tests.
Get Screen Coordinates with Python (PyAutoGUI)
Python's PyAutoGUI library is the most popular cross-platform tool for automating mouse movements and reading screen coordinates. It works on Windows 11, macOS, and Linux with the same API. For the complete fix for DPI-scaled multi-monitor setups, see our PyAutoGUI Coordinates guide.
Basic PyAutoGUI Coordinate Reading
import pyautogui
# Get current mouse position
x, y = pyautogui.position()
print(f"Current mouse position: ({x}, {y})")
# Get screen size
width, height = pyautogui.size()
print(f"Screen size: {width}x{height}")
Handling DPI Scaling on Windows 11
On Windows 11 with display scaling enabled, PyAutoGUI may return logical coordinates instead of physical pixels. To get accurate screen coordinates, declare DPI awareness before importing PyAutoGUI:
import ctypes
import pyautogui
# Declare DPI awareness BEFORE using pyautogui
ctypes.windll.user32.SetProcessDPIAware()
# Now pyautogui.size() returns PHYSICAL pixels
width, height = pyautogui.size()
print(f"Physical screen size: {width}x{height}")
# Move mouse and click
pyautogui.moveTo(960, 540, duration=1)
pyautogui.click()
Real-Time Mouse Tracking with Python
You can build a simple mouse coordinate tracker that prints position in real time:
import pyautogui
import time
try:
while True:
x, y = pyautogui.position()
print(f"\rMouse: ({x}, {y})", end="", flush=True)
time.sleep(0.1)
except KeyboardInterrupt:
print("\nTracking stopped.")
Press Ctrl+C to stop the script. This is useful for debugging automation scripts or recording coordinate sequences.
Tip: On macOS, PyAutoGUI works in logical points — the same coordinate system used by Cmd+Shift+4 and AppleScript. No conversion is needed between these tools. Just remember that screenshots are saved at Retina resolution (2× the logical dimensions), so image-based automation (OpenCV, template matching) needs to account for the difference.
Platform Comparison Cheat Sheet
| Task | Windows | macOS | Web Tool |
|---|---|---|---|
| Quick one-off measurement | Paste screenshot into Paint | Cmd+Shift+4 crosshair | Open tool, read value |
| Live tracking with copy-paste | Online fullscreen tool | Online fullscreen tool | Online fullscreen tool (native) |
| Measure from static image | Paste into Paint or online tool | Paste into Preview or online tool | Paste into online tool |
| Multi-monitor coordinates | Settings > Display layout | System Settings > Displays | Move mouse across bezels |
| DPI / scaling handling | SetProcessDPIAware() | Multiply by backingScaleFactor | Handled automatically by browser |
| Automation library | PyAutoGUI, AutoHotkey | PyAutoGUI, AppleScript, Hammerspoon | Selenium, Playwright, Cypress |