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.
npm install domain-rank
# or
pnpm add domain-rank
# or
yarn add domain-rankimport { 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
// }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, ... },
// ...
// ]import { searchDomains } from 'domain-rank';
const results = searchDomains('social', 5);
// Returns up to 5 domains matching 'social' in name, domain, or title
// sorted by rankimport { 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'import { formatDomainAsTitle } from 'domain-rank';
const formatted = formatDomainAsTitle('nytimes.com');
// Returns: "NY Times" - human-readable name with proper capitalizationimport { 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- 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)
| Rank | Domain | Name |
|---|---|---|
| 1 | facebook.com | |
| 2 | google.com | |
| 3 | instagram.com | |
| 4 | youtube.com | YouTube |
| 5 | linkedin.com |
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.
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)
The ranking combines multiple authoritative sources:
-
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)
-
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.
Look up information for a specific domain.
Get top N domains by rank. Default: 100.
Search domains by name/domain/title. Default limit: 10.
Get all domains sorted by rank.
Get total number of domains in the dataset.
Fetch favicon for a domain. Returns base64 by default, or URL if formatBase64 is false.
Format domain into human-readable name with proper capitalization.
Clean and normalize a page title (removes common suffixes, HTML, etc.).
Check if a domain should be removed from rankings.
Find the main domain for a given alternate domain.
Get a custom title override for a domain.
Fetch the page title from a domain's website.
Extract domain from URL.
Validate URL format.
# Install dependencies
pnpm install
# Type check
pnpm run type-check
# Build library
pnpm run build
# Run tests
pnpm testMIT
