Use Domain Name Validator

Enter your data below to use the Domain Name Validator

📌 Try these examples:
RESULT

Last updated

Domain Name Validation Rules

Domain names follow strict rules defined in RFC 1035 and RFC 1123. A valid domain name consists of labels separated by dots, where each label must be 1–63 characters, contain only letters, digits, and hyphens, and not start or end with a hyphen. The total domain name length (including dots) must not exceed 253 characters.

Validation Rules Summary

RuleValidInvalid
Charactersa-z, 0-9, hyphenunderscore, space, @
Label start/endLetter or digitHyphen
Label length1–63 chars0 or 64+ chars
Total length≤253 chars254+ chars
TLD2+ chars, letters onlyAll-numeric TLD
IDNxn-- prefix (punycode)Raw Unicode (in DNS)

Domain Validation in JavaScript

JavaScript
function validateDomain(domain) {
  if (!domain || domain.length > 253) return { valid: false, reason: 'Invalid length' };

  // Remove trailing dot (FQDN)
  const d = domain.endsWith('.') ? domain.slice(0, -1) : domain;
  const labels = d.split('.');

  if (labels.length < 2) return { valid: false, reason: 'Need at least 2 labels' };

  const labelRegex = /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
  for (const label of labels) {
    if (!label) return { valid: false, reason: 'Empty label' };
    if (label.length > 63) return { valid: false, reason: `Label too long: ${label}` };
    if (!labelRegex.test(label)) return { valid: false, reason: `Invalid label: ${label}` };
  }

  // TLD must be alphabetic
  const tld = labels[labels.length - 1];
  if (!/^[a-zA-Z]{2,}$/.test(tld)) return { valid: false, reason: `Invalid TLD: ${tld}` };

  return { valid: true };
}

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.