v1.0.0 Now Available

Parse User-Agent Strings with Precision & Speed

A lightweight, fast, and accurate user-agent parser for JavaScript and TypeScript. Extract browser, OS, device, and engine information effortlessly.

npm install client-parser

Why Choose Client Parser?

Built for modern web applications with performance and accuracy in mind

Lightning Fast
Optimized parsing algorithms ensure minimal performance impact on your application.
Highly Accurate
Comprehensive regex patterns cover thousands of user-agent variations.
TypeScript Ready
Full TypeScript support with comprehensive type definitions out of the box.
Browser Detection
Identify all major browsers including Chrome, Firefox, Safari, Edge, and more.
OS & Device Info
Extract operating system, device type, brand, and model information.
Engine Detection
Detect rendering engines like WebKit, Blink, Gecko, and more.
Live Demo

Try It Yourself

Paste any User-Agent string and see the parsed results instantly

Input
Enter a User-Agent string to parse

Try sample User-Agents:

Output
Parsed client information

Results will appear here after parsing

Simple & Intuitive

Get started in seconds with our straightforward

Basic Usage

example.ts
import getDeviceType from 'client-parser';

const userAgent = navigator.userAgent;
const result = getDeviceType(userAgent);

console.log(result.browser); // { name: 'Chrome', version: '120.0.0.0' }
console.log(result.os);      // { name: 'Windows', version: '10' }
console.log(result.device);  // { type: 'pc' }

Server-Side (Node.js)

server.ts
import getDeviceType from 'client-parser';
import { IncomingMessage } from 'http';

function getUserInfo(req: IncomingMessage) {
  const userAgent = req.headers['user-agent'] || '';
  const client = getDeviceType(userAgent);

  return {
    browser: client.browser?.name,
    os: client.os?.name,
    isBot: client.isBot,
  };
}

TypeScript Types

types.ts
interface IDeviceInfo {
  userAgentString: string;
  device: {
    type: string;
    name: string;
    model: string;
    manufacturer?: string;
  };
  engine: {
    name: string;
    version: string;
  };
  os: {
    name: string;
    version?: string;
    architecture?: string;
  };
  browser: {
    name: string;
    version: string;
  };
  platform: string;
  isBot: boolean;
}

Ready to Get Started?

Install client-parser today and start parsing user-agent strings in your projects.