npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

domain-rank

v0.1.154

Published

Domain Rank Top Million domains, source names, duplicates, and favicons

Readme

domain-rank

Look up top-ranked domains to get their name, human-readable source label, influence rank, and favicon.

Rank data comes from the Tranco List (aggregates Cisco Umbrella, Majestic, Farsight, Chrome UX, and Cloudflare Radar) and CommonCrawl backlink counts.

Use cases: search/URL autocomplete, bookmark launchers, LLM web-app recommendations, domain reputation scoring.

Installation

npm install domain-rank
# or
pnpm add domain-rank
# or
yarn add domain-rank

Usage

Look up a domain

import { lookupDomain } from 'domain-rank';

const result = lookupDomain('facebook.com');
console.log(result);
// {
//   domain: 'facebook.com',
//   name: 'Facebook',
//   rank: 1,
//   title: 'Facebook',
//   newsRank: undefined,
//   newsTitle: undefined,
//   langCode: undefined
// }

Get top domains

import { getTopDomains } from 'domain-rank';

// Get top 10 domains
const top10 = getTopDomains(10);
console.log(top10);
// [
//   { domain: 'facebook.com', name: 'Facebook', rank: 1, ... },
//   { domain: 'google.com', name: 'Google', rank: 2, ... },
//   { domain: 'instagram.com', name: 'Instagram', rank: 3, ... },
//   ...
// ]

Search domains

import { searchDomains } from 'domain-rank';

const results = searchDomains('social', 5);
// Returns up to 5 domains matching 'social' in name, domain, or title
// sorted by rank

Get favicon

import { getFaviconForDomain } from 'domain-rank';

// Get as base64
const base64Favicon = await getFaviconForDomain('google.com');

// Get as URL
const faviconURL = await getFaviconForDomain('google.com', false);
// Returns: 'https://www.google.com/s2/favicons?domain=google.com'

Format domain names

import { formatDomainAsTitle } from 'domain-rank';

const formatted = formatDomainAsTitle('nytimes.com');
// Returns: "NY Times" - human-readable name with proper capitalization

Utility functions

import { convertURLToDomain, isURLValid, getTotalDomains } from 'domain-rank';

// Extract domain from URL
const domain = convertURLToDomain('https://en.wikipedia.org/wiki/Main_Page');
// Returns: 'wikipedia'

// Validate URL
const isValid = isURLValid('https://example.com');
// Returns: true

// Get total number of domains in dataset
const total = getTotalDomains();
// Returns: ~100000

Dataset Statistics

  • Total domains: 10,020 top-ranked domains
  • Data file: data/domain-rank-merged.json (297 KB)
  • Format: Pre-loaded in memory for instant lookups
  • Bundle size:
    • ESM: 828 KB (231 KB gzipped)
    • CJS: 828 KB (231 KB gzipped)

Top 5 Domains

| Rank | Domain | Name | |------|--------|------| | 1 | facebook.com | Facebook | | 2 | google.com | Google | | 3 | instagram.com | Instagram | | 4 | youtube.com | YouTube | | 5 | linkedin.com | LinkedIn |

Data Format

Source Data

The raw data is stored in data/domain-rank-merged.json as a compact object format:

{
  "facebook.com": ["Facebook", 1],
  "google.com": ["Google", 2],
  "nytimes.com": [197, 38, "NY Times"]
}

Format: [name, rank] or [newsRank, rank, title] for news domains.

Library API

The library includes 10,020 top-ranked domains with the following information:

  • domain: The domain name (e.g., "facebook.com")
  • name: Human-readable name (e.g., "Facebook")
  • rank: Overall influence rank (lower is better, 1 is top)
  • title: Full title/description
  • newsRank: Rank for news/media domains (if applicable)
  • newsTitle: Media-specific title (if applicable)
  • langCode: Primary language code (if applicable)

Data Sources

The ranking combines multiple authoritative sources:

  1. Tranco List - Aggregates:

    • Cisco Umbrella (DNS resolver data)
    • Majestic Million (backlink analysis)
    • Farsight (passive DNS data)
    • Chrome UX Report (real user metrics)
    • Cloudflare Radar (global network data)
  2. CommonCrawl - Web-wide backlink counts from petabytes of crawled data

This multi-source approach provides a more stable and manipulation-resistant ranking than single-source lists.

API Reference

lookupDomain(domain: string): DomainLookupResult | null

Look up information for a specific domain.

getTopDomains(n?: number): DomainLookupResult[]

Get top N domains by rank. Default: 100.

searchDomains(query: string, limit?: number): DomainLookupResult[]

Search domains by name/domain/title. Default limit: 10.

getAllDomains(): DomainLookupResult[]

Get all domains sorted by rank.

getTotalDomains(): number

Get total number of domains in the dataset.

getFaviconForDomain(urlOrDomain: string, formatBase64?: boolean): Promise<string>

Fetch favicon for a domain. Returns base64 by default, or URL if formatBase64 is false.

formatDomainAsTitle(domain: string): string

Format domain into human-readable name with proper capitalization.

cleanSourceTitle(title: string): string | null

Clean and normalize a page title (removes common suffixes, HTML, etc.).

shouldRemoveDomain(domain: string): boolean

Check if a domain should be removed from rankings.

findMainDomain(domain: string): string | null

Find the main domain for a given alternate domain.

getTitleOverride(domain: string): string | null

Get a custom title override for a domain.

getSourceTitle(domain: string): Promise<string | null>

Fetch the page title from a domain's website.

convertURLToDomain(url: string): string

Extract domain from URL.

isURLValid(url: string): boolean

Validate URL format.

Development

# Install dependencies
pnpm install

# Type check
pnpm run type-check

# Build library
pnpm run build

# Run tests
pnpm test

License

MIT