JavaScript Navigator platform Property

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline

What You’ll Learn

navigator.platform is a read-only string that identifies the platform the browser is running on. Learn common values, why OS sniffing is unreliable, MDN’s ⌘ vs Ctrl shortcut tip, five examples, and try-it labs.

01

Kind

Read-only property

02

Returns

String

03

Baseline

Widely available

04

Examples

MacIntel · Win32

05

Sniffing?

Not recommended

06

Good use

Shortcut key labels

Introduction

navigator.platform answers a short question: what platform string does the browser report? You might see values such as MacIntel, Win32, or Linux x86_64.

That sounds perfect for OS detection — but MDN warns that using platform (or the user agent) to work around bugs is unreliable. Prefer feature detection for real capability checks.

💡
One solid UI use case

MDN highlights keyboard-shortcut advice: show on Apple platforms and Ctrl elsewhere. That is presentation help — not feature gating.

Understanding the platform Property

Think of platform as a coarse label the browser exposes about its host environment. You read it; you never assign to it.

  • String — examples include MacIntel, Win32, Linux x86_64.
  • Windows note — modern browsers often return Win32 even on 64-bit Windows.
  • Read-only — part of the HTML Navigator interface.
  • Baseline — Widely available (MDN, since July 2015).
  • Not for sniffing — prefer feature detection for APIs you need.

📝 Syntax

General form of the property:

JavaScript
navigator.platform

Value

  • A string indicating a platform.

Common patterns

JavaScript
// Read the string:
console.log(navigator.platform);

// MDN: modifier key hint for shortcuts
const modifierKeyPrefix =
  navigator.platform.startsWith("Mac") || navigator.platform === "iPhone"
    ? "⌘"
    : "Ctrl";

// Prefer this for real features:
if ("serviceWorker" in navigator) {
  // Use Service Workers — do not sniff platform instead
}

⚡ Quick Reference

GoalCode
Read platformnavigator.platform
Looks like Mac?navigator.platform.startsWith("Mac")
iPhone exact matchnavigator.platform === "iPhone"
Shortcut prefix (MDN)Mac / iPhone ? "⌘" : "Ctrl"
Writable?No (read-only)
Status (MDN)Baseline Widely available

🔍 At a Glance

Four facts to remember about navigator.platform.

Returns
string

Platform label

Baseline
widely

Since July 2015

Windows
Win32

Even on 64-bit

Prefer
feature detect

Not OS sniffing

📋 platform vs Feature Detection

navigator.platformFeature detection
Question“What platform string is reported?”“Does this API exist here?”
Reliability for bugsLow (MDN discourages sniffing)High for capability checks
Good forShortcut key labels (⌘ / Ctrl)Enabling Service Workers, WebRTC, etc.
ExamplestartsWith("Mac")"serviceWorker" in navigator
Use together?Yes — optional UI hints from platform; real features from detection

Examples Gallery

Examples follow MDN navigator.platform guidance. Prefer Try It Yourself to see your browser’s string.

📚 Getting Started

Read the string and apply MDN’s modifier-key pattern.

Example 1 — Read platform

Log the current platform string.

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

How It Works

Your exact value depends on OS and browser. Treat it as a hint, not absolute truth.

Example 2 — MDN Modifier Key Prefix

Choose on Apple platforms and Ctrl elsewhere.

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

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

How It Works

This is MDN’s recommended practical use: UI advice for shortcuts, not feature detection.

📈 Practical Patterns

Windows quirks, type checks, and preferring real capability detection.

Example 3 — Windows Win32 Note

Do not assume Win32 means a 32-bit OS.

JavaScript
const p = navigator.platform;
if (p === "Win32") {
  console.log("Reports Win32 (common even on 64-bit Windows)");
} else {
  console.log("platform: " + p);
}
Try It Yourself

How It Works

MDN documents this Windows quirk explicitly — another reason sniffing bitness from platform fails.

Example 4 — Confirm String Type

Beginner sanity check for the property type.

JavaScript
const lines = [
  "value: " + navigator.platform,
  "typeof: " + typeof navigator.platform
];
console.log(lines.join("\n"));
Try It Yourself

How It Works

You always get a string (when the property is present in normal browsers).

Example 5 — Prefer Feature Detection

Keep platform for labels; use capability checks for features.

JavaScript
const lines = [];
lines.push(
  "platform: " + navigator.platform + " — OK for shortcut labels"
);
lines.push(
  "serviceWorker: " +
    ("serviceWorker" in navigator ? "available" : "missing") +
    " — use this for features"
);
console.log(lines.join("\n"));
Try It Yourself

How It Works

Matches MDN advice: do not use platform to work around missing features — detect the features themselves.

🚀 Common Use Cases

  • Shortcut help text — show ⌘ vs Ctrl in editor / docs UI (MDN pattern).
  • Diagnostics — include platform in optional debug panels.
  • Learning Navigator — understand classic client-identification strings.
  • Not for feature gates — do not enable APIs based on platform alone.
  • Not for bitness checksWin32 is not proof of 32-bit Windows.

🧠 How navigator.platform Works

1

Browser exposes a label

The engine reports a platform string on navigator.

Expose
2

You read the string

Values like MacIntel or Win32.

String
3

Optional UI hint

Use carefully for shortcut labels (⌘ / Ctrl).

UX
4

Features use detection

Gate APIs with in checks, not platform sniffing.

📝 Notes

  • Baseline Widely available (MDN, since July 2015).
  • Not Deprecated, Experimental, or Non-standard — no status banner required.
  • Read-only string on Navigator.
  • MDN: unreliable for browser / OS sniffing — prefer feature detection.
  • On Windows, modern browsers often return Win32 even on 64-bit systems.
  • Related: oscpu, appVersion, permissions, Window.

Universal Browser Support

navigator.platform is Baseline Widely available across modern browsers (MDN: since July 2015). Use it sparingly for UI hints; prefer feature detection for real capabilities.

Baseline · Widely available

Navigator.platform

Read the platform string for optional shortcut labels. Do not rely on it for OS sniffing or feature branching.

Universal Widely available
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 & Legacy
Full support
Opera Full support · Modern versions
Full support
Internet Explorer Supported in legacy IE
Full support
platform Excellent

Bottom line: Read navigator.platform for labels if needed, remember the Win32 quirk, and detect features instead of sniffing the OS.

Conclusion

navigator.platform is a Baseline string naming the reported platform. Use MDN’s ⌘ / Ctrl pattern for shortcut help when useful, avoid OS sniffing for features, and remember that Win32 is common even on 64-bit Windows.

Continue with preferences, permissions, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use platform for optional shortcut key labels
  • Prefer feature detection for APIs
  • Remember the Windows Win32 quirk
  • Keep sniffing logic out of production feature gates
  • Document any UI-only platform checks

❌ Don’t

  • Gate features on Mac / Win / Linux strings
  • Assume Win32 means 32-bit Windows
  • Replace capability checks with platform regexes
  • Try to assign to navigator.platform
  • Confuse this with the non-standard oscpu string

Key Takeaways

Knowledge Unlocked

Five things to remember about platform

Baseline platform string — labels OK, sniffing not.

5
Core concepts
⌨️ 02

Good use

⌘ / Ctrl hints

UX
⚠️ 03

Windows

often Win32

Quirk
🔒 04

Access

read-only

API
🎯 05

Prefer

feature detect

Modern

❓ 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 as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. Still, MDN recommends 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.
Did you know?

Browsers are reducing how much environment detail they leak (user-agent reduction and related privacy work). That makes platform sniffing even less dependable over time — another vote for feature detection.

Learn preferences Next

Experimental User Preferences API via PreferenceManager.

preferences →

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.

8 people found this page helpful