Skip to content
totpero edited this page Jul 16, 2026 · 3 revisions

DeviceDetector.NET

Build status NuGet

DeviceDetector.NET is the universal device detection library for .NET. It parses HTTP User-Agent strings (and, optionally, User-Agent Client Hints) to detect:

  • Devices — desktop, smartphone, tablet, phablet, TV, console, car browser, camera, portable media player, wearable, smart display, smart speaker, peripheral
  • Clients — browsers, feed readers, media players, mobile apps, PIMs, libraries
  • Operating systems — name, version, family
  • Bots — crawlers, spiders, monitoring tools
  • Brands and models — for mobile/hardware devices

It is a faithful port of the popular PHP library matomo-org/device-detector, tracked as a git submodule (device-detector) so the regex rule set stays in sync with upstream. For most detection questions ("why wasn't X detected as Y"), the upstream PHP documentation and issue tracker apply directly — the rules themselves are shared, only the code that executes them differs.

Where to start

I want to... Go to
Add the library to my project and parse my first User-Agent Getting Started
Check Is*() helpers (IsSmartphone, IsBrowser, ...) Device and Client Type Checks
Use Client Hints instead of / together with User-Agent Client Hints
Speed up repeated parsing with caching Caching
Use a PCRE-compatible regex engine for better upstream YAML compatibility Regex Engines
Detect bots without paying for full parsing Bot Detection
Use it in ASP.NET Core app logic (DI, IsMobile() per request) ASP.NET Core Integration
Render an icon (browser/OS/brand/device) next to a detection result Icon Packs
Enrich ASP.NET Core logs with device info Serilog.Enrichers.AspNetCore.DeviceDetector
Pre-warm a cache database for known User-Agents CacheBuilder Tool
Update the bundled detection rules from the PHP project Updating Device Detector Data
Report a bug or send a pull request Contributing
Something isn't detected correctly FAQ

Repository layout

License

DeviceDetector.NET is licensed under the Apache License 2.0 — see LICENSE. Note that the upstream PHP project it ports (matomo-org/device-detector) is licensed under LGPL v3 or later; if you redistribute the vendored YAML rule data itself, check compliance with the upstream license as well.

Clone this wiki locally