JavaScript Navigator platform Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

navigator.platform is a read-only string that identifies the platform the browser is running on — for example "MacIntel", "Win32", or "Linux x86_64" (MDN).

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.platform. Start with this line.

JavaScript
navigator.platform
CallWhat it does
navigator.platformPrimary signature.

Built into the browser. Read navigator.platform on Navigator — no import required.

Library declarations
JavaScript
navigator.platform

Parameters

ParameterDescription
Apple checkOptional. Choose ⌘ vs Ctrl for UI copy

Return Value

Return ValueDescription
*The current value of navigator.platform.

JavaScript Examples

Example 1 — Read the Platform String

Log whatever this browser reports for navigator.platform.

JavaScript
console.log(navigator.platform);
// e.g. "Win32", "MacIntel", "Linux x86_64"
Try It Yourself

How It Works

  1. Read the property. No arguments — just access navigator.platform.
  2. Get a string. Common values include MacIntel, Win32, and Linux variants.
  3. Windows quirk. Win32 often appears even on 64-bit Windows.
  4. Read-only. You inspect the value; you do not assign to it.

Example 2 — Shortcut Modifier (MDN)

Show ⌘ on Apple platforms and Ctrl elsewhere for UI hints.

JavaScript
const modifierKeyPrefix =
  navigator.platform.startsWith("Mac") || navigator.platform === "iPhone"
    ? "⌘"
    : "Ctrl";

console.log("Save: " + modifierKeyPrefix + "+S");
Try It Yourself

How It Works

  1. Apple check. startsWith("Mac") or exact "iPhone".
  2. Pick the label. Apple → ⌘; otherwise → Ctrl.
  3. Build UI copy. Useful for shortcut help text in menus or tooltips.
  4. Scope. Presentation only — not a feature gate.

Example 3 — Prefer Feature Detection

Check the API itself instead of sniffing the OS string.

JavaScript
// ✗ brittle: if (navigator.platform === "Win32") { … }

// ✓ reliable: test the capability
if ("geolocation" in navigator) {
  console.log("Geolocation API available");
} else {
  console.log("Geolocation API missing — use a fallback");
}

console.log("platform (info only): " + navigator.platform);
Try It Yourself

How It Works

  1. Skip sniffing. Platform strings are coarse and can mislead.
  2. Test the feature. "geolocation" in navigator answers the real question.
  3. Fallback path. Handle missing APIs without guessing the OS.
  4. Optional log. Keep platform for diagnostics or UI hints only.

Browser Support

navigator.platform is Baseline Widely available (MDN: since July 2015). Support is excellent — the hard part is using it wisely (UI hints only, not sniffing).

✓ Baseline · Widely available

Navigator.platform

Read-only platform string such as MacIntel, Win32, or Linux x86_64. Prefer feature detection for capabilities; use platform mainly for shortcut-label UX.

98% Browser support
Google Chrome Full support · Desktop & Mobile
Full support
Mozilla Firefox Full support · Desktop & Mobile
Full support
Apple Safari Full support · macOS & iOS
Full support
Microsoft Edge Full support · Chromium
Full support
Opera Full support · Modern versions
Full support
Internet Explorer Supported (legacy)
Full support
platform Excellent

Bottom line: Available almost everywhere. Read it for coarse labels or ⌘/Ctrl hints — never as a substitute for testing the real API.

Frequently Asked Questions

It is a read-only Navigator property that returns a string identifying the platform the browser is running on — for example MacIntel, Win32, or Linux x86_64.
No. MDN marks it Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. MDN still warns against using it for browser or OS sniffing.
MDN notes that on Windows, modern browsers return Win32 even when running on 64-bit Windows. Do not treat Win32 as proof of a 32-bit OS.
No for feature branching. Prefer feature detection. Platform strings are coarse, can be reduced for privacy, and encourage brittle sniffing.
MDN shows a practical UI case: choosing ⌘ vs Ctrl for keyboard-shortcut hints on Apple vs non-Apple systems.
No. The property is read-only. You read the string; you do not assign to it.

Next: preferences

Continue with the next Navigator property in the JavaScript guide.

preferences tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful