DeviceDetector.NET
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
Install / Use
/learn @totpero/DeviceDetector.NETREADME
DeviceDetector.NET
Description
The Universal Device Detection library for .NET that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, feed readers, media players, PIMs, ...), operating systems, brands and models. This is a port of the popular PHP device-detector library to C#. For the most part you can just follow the documentation for device-detector with no issue.
Usage
Using DeviceDetector.NET with nuget is quite easy. Just add DeviceDetector.NET to your projects requirements. And use some code like this one:
using DeviceDetectorNET;
// OPTIONAL: Set version truncation to none, so full versions will be returned
// By default only minor versions will be returned (e.g. X.Y)
// for other options see VERSION_TRUNCATION_* constants in DeviceParserAbstract class
// add using DeviceDetectorNET.Parser;
DeviceDetector.SetVersionTruncation(VersionTruncation.VERSION_TRUNCATION_NONE);
var userAgent = Request.Headers["User-Agent"]; // change this to the useragent you want to parse
var headers = Request.Headers.ToDictionary(a => a.Key, a => a.Value.ToArray().FirstOrDefault());
var clientHints = ClientHints.Factory(headers); // client hints are optional
var dd = new DeviceDetector(userAgent, clientHints);
// OPTIONAL: Set caching method
// By default static cache is used, which works best within one php process (memory array caching)
// To cache across requests use caching in files or memcache
// add using DeviceDetectorNET.Cache;
dd.SetCache(new DictionaryCache());
// OPTIONAL: If called, GetBot() will only return true if a bot was detected (speeds up detection a bit)
dd.DiscardBotInformation();
// OPTIONAL: If called, bot detection will completely be skipped (bots will be detected as regular devices then)
dd.SkipBotDetection();
dd.Parse();
if(dd.IsBot()) {
// handle bots,spiders,crawlers,...
var botInfo = dd.GetBot();
} else {
var clientInfo = dd.GetClient(); // holds information about browser, feed reader, media player, ...
var osInfo = dd.GetOs();
var device = dd.GetDeviceName();
var brand = dd.GetBrandName();
var model = dd.GetModel();
}
Instead of using the full power of DeviceDetector it might in some cases be better to use only specific parsers. If you aim to check if a given useragent is a bot and don't require any of the other information, you can directly use the bot parser.
using DeviceDetectorNET.Parser;
var botParser = new BotParser();
botParser.SetUserAgent(userAgent);
// OPTIONAL: discard bot information. Parse() will then return true instead of information
botParser.DiscardDetails = true;
var result = botParser.Parse();
if (result != null) {
// do not do anything if a bot is detected
return;
}
// handle non-bot requests
The default regexes directory path can be changed like this:
DeviceDetectorSettings.RegexesDirectory = @"C:\YamlRegexsFiles\";
Device Detector for other languages
There are already a few ports of this tool to other languages:
- PHP https://github.com/matomo-org/device-detector
- Ruby https://github.com/podigee/device_detector
- JavaScript/TypeScript/NodeJS https://github.com/etienne-martin/device-detector-js
- NodeJS https://github.com/sanchezzzhak/node-device-detector
- Python 3 https://github.com/thinkwelltwd/device_detector
- Crystal https://github.com/creadone/device_detector
- Elixir https://github.com/elixir-inspector/ua_inspector
- Java https://github.com/mngsk/device-detector
- Java https://github.com/deevvicom/device-detector
- Java https://github.com/PaniniGelato/java-device-detector
- Rust https://github.com/simplecastapps/rust-device-detector
- Rust https://github.com/stry-rs/device-detector
- Go https://github.com/gamebtc/devicedetector
- Go https://github.com/umutbasal/device-detector-go
- Go https://github.com/robicode/device-detector
Icon packs
If you are looking for icons to use alongside Device Detector, these repositories can be of use:
.....
The lists below are auto generated and updated from time to time. Some of them might not be complete.
Last update: 2026/02/01
List of detected operating systems:
AIX, Android, Android TV, Alpine Linux, Amazon Linux, AmigaOS, Armadillo OS, AROS, tvOS, ArcaOS, Arch Linux, AOSC OS, ASPLinux, Azure Linux, BackTrack, Bada, Baidu Yi, BeOS, BlackBerry OS, BlackBerry Tablet OS, blackPanther OS, Bliss OS, Brew, BrightSignOS, BSD, Caixa Mágica, CentOS, CentOS Stream, Clear Linux OS, ClearOS Mobile, Chrome OS, Chromium OS, China OS, Contiki, Coolita OS, CyanogenMod, Debian, Deepin, DragonFly, DVKBuntu, ElectroBSD, elementary OS, EulerOS, Fedora, Fenix, Firefox OS, Fire OS, Foresight Linux, Freebox, FreeBSD, FRITZ!OS, FydeOS, Fuchsia, Gentoo, GENIX, GEOS, GhostBSD, gNewSense, GridOS, Google TV, HP-UX, Haiku OS, iPadOS, HarmonyOS, HasCodingOS, HELIX OS, IRIX, Inferno, Java ME, Joli OS, KaiOS, Kali, Kanotix, KIN OS, KolibriOS, Knoppix, KreaTV, Kubuntu, GNU/Linux, LeafOS, LindowsOS, Linspire, Lineage OS, Linpus, Liri OS, Loongnix, Lubuntu, Lumin OS, LuneOS, VectorLinux, Mac, Maemo, Mageia, Mandriva, MeeGo, Meta Horizon, MINIX, Mocor OS, MocorDroid, moonOS, Motorola EZX, Mint, MildWild, MorphOS, NetBSD, MTK / Nucleus, MRE, NeXTSTEP, NEWS-OS, Nintendo, Nintendo Mobile, Nova, NuttX, OS/2, OSF1, openSUSE, OpenBSD, OpenHarmony, OpenVMS, OpenVZ, OpenWrt, Opera TV, Oracle Linux, Ordissimo, Orsay, Pardus, PCLinuxOS, PICO OS, Plan 9, Plasma Mobile, PlayStation Portable, PlayStation, Proxmox VE, Puffin OS, PureOS, Qtopia, Raspberry Pi OS, Raspbian, Red Hat, Red Star, RedOS, Revenge OS, risingOS, RISC OS, Rocky Linux, Roku OS, Rosa, RouterOS, Remix OS, Resurrection Remix OS, REX, RazoDroiD, RTOS & Next, Sabayon, SUSE, Sailfish OS, Scientific Linux, SeewoOS, SerenityOS, Sirin OS, Slackware, Smartisan OS, Solaris, Star-Blade OS, Syllable, Symbian, Symbian OS, Symbian OS Series 40, Symbian OS Series 60, Symbian^3, TencentOS, ThreadX, Titan OS, Tizen, TiVo OS, TmaxOS, Turbolinux, Ubuntu, ULTRIX, UOS, VIDAA, ViziOS, watchOS, Wear OS, WebTV, Whale OS, Windows, Windows CE, Windows IoT, Windows Mobile, Windows Phone, Windows RT, WoPhone, Xbox, Xubuntu, YunOS, Zenwalk, ZorinOS, iOS, palmOS, Webian, webOS
List of detected browsers:
Via, Pure Mini Browser, Pure Lite Browser, Raise Fast Browser, Rabbit Private Browser, Fast Browser UC Lite, Fast Explorer, Lightning Browser, Cake Browser, IE Browser Fast, Vegas Browser, OH Browser, OH Private Browser, XBrowser Mini, Sharkee Browser, Lark Browser, Pluma, Anka Browser, Azka Browser, Dragon Browser, Easy Browser, Dark Web Browser, Dark Browser, 18+ Privacy Browser, 115 Browser, 1DM Browser, 1DM+ Browser, 2345 Browser, 360 Secure Browser, 360 Phone Browser, 7654 Browser, Avant Browser, ABrowse, Ace, Acoo Browser, AdBlock Browser, Adult Browser, Ai Browser, Airfind Secure Browser, ANT Fresco, ANTGalio, Aloha Browser, Aloha Browser Lite, ALVA, AltiBrowser, Amaya, Amaze Browser, Amerigo, Amigo, Android Browser, Anonyv Browser, AOL Explorer, AOL Desktop, AOL Shield, AOL Shield Pro, Aplix, AppBrowzer, AppTec Secure Browser, APUS Browser, Arora, Arctic Fox, Amiga Voyager, Amiga Aweb, APN Browser, Arachne, Arc Search, Armorfly Browser, ArtisBrowser, Arvin, Ask.com, Ask Browser, Asus Browser, Atom, Atomic Web Browser, Atlas, Avast Secure Browser, AVG Secure Browser, Avira Secure Browser, AwoX, Awesomium, Basic Web Browser, Beaker Browser, Beamrise, BF Browser, BlackBerry Browser, Bluefy, BrowseHere, Browser Hup Pro, Baidu Browser, Baidu Spark, Bang, Bangla Browser, Basilisk, Belva Browser, Beyond Private Browser, Beonex, Berry Browser, Bitchute Browser, BizBrowser, Black Browser, BlackHawk, Blazer, Bloket, Bunjalloo, B-Line, Black Lion Browser, Blue Browser, Bonsai, Borealis Navigator, Brave, BriskBard, BroKeep Browser, Browspeed Browser, BrowseX, Browzar, Browlser, Browse Safe, Browser Mini, BrowsBit, Biyubi, Byffox, BXE Browser, Camino, Catalyst, Catsxp, Cave Browser, CCleaner, CG Browser, ChanjetCloud, Chedot, Cherry Browser, Centaury, Clario Browser, Clear TV Browser, Cliqz, Coc Coc, CoolBrowser, Colibri, Columbus Browser, Comet, Comodo Dragon, Coast, Charon, ChatGPT Atlas, CM Browser, CM Mini, Chrome Frame, Headless Chrome, Chrome, Chrome Mobile iOS, Conkeror, Chrome Mobile, Chowbo, Classilla, CoolNovo, Colom Browser, CometBird, Comfort Browser, COS Browser, Cornowser, Chim Lac, ChromePlus, Chromium, Chromium GOST, Cyberfox, Cheshire, Cromite, Crow Browser, Crusta, Craving Explorer, Crazy Browser, Cunaguaro, Chrome Webview, CyBrowser, dbrowser, Peeps dBrowser, Dark Web, Dark Web Private, DDU Browser, Debuggable Browser, Decentr, Deepnet Explorer, deg-degan, Deledao, Delta Browser, Desi Browser, DeskBrowse, Dezor, Diigo Browser, DoCoMo, Dolphin, Dolphin Zero, Dorado, Dot Browser, Dooble, Doubao, Dillo, DUC Browser, DuckDuckGo Privacy Browser, East Browser, Ecosia, Edge WebView, Every Browser, Epic, Elinks, EinkBro, Element Browser, Elements Browser, Eolie, Explore Browser, eZ Browser, EudoraWeb, E
