Hostname Validator

Validate hostnames per RFC standards

Input Hostnames

RFC 1123 Hostname Rules:

  • Labels must be 1-63 characters, total max 253
  • Start and end with alphanumeric characters
  • Only letters, numbers, and hyphens allowed

Validation Results

Validation results will appear here

The Hostname Validator checks whether a given string is a valid hostname according to RFC 1123 rules. Enter a value like web-server-01.example.com or my-app and the tool instantly reports whether it passes or fails validation, with specific details about any violations such as illegal characters, length overruns, or improperly placed hyphens.

Understanding Hostname Validation

If you work with servers, DNS, or any kind of network infrastructure, hostnames are everywhere. They appear in DNS records, TLS certificate requests, web server configurations, hosts files, and monitoring dashboards. A hostname that looks fine to the human eye can silently break things if it contains a character or pattern that violates the rules. An underscore in a hostname might work in your local DNS resolver but cause a certificate authority to reject your CSR. A label that starts with a hyphen might load in one application but fail in another. These kinds of problems are hard to diagnose because the hostname looks reasonable at first glance.

RFC 1123 updated the original RFC 952 specification to define the hostname syntax used across the internet today. The rules are straightforward but easy to violate by accident: each label (the sections between dots) can only contain ASCII letters, digits, and hyphens, must start and end with an alphanumeric character, and cannot exceed 63 characters. The total hostname including all labels and dots must stay under 253 characters. These constraints exist because they map directly to how DNS encodes names on the wire, and every DNS implementation, mail server, and certificate authority enforces them.

This validator applies those rules systematically. You paste in a hostname and get an immediate pass or fail result with the specific rule that was violated. It catches underscores, leading or trailing hyphens, overlength labels, special characters, spaces, and total length overruns. Whether you are validating a single hostname before requesting a certificate or auditing a configuration file with hundreds of entries, the tool tells you exactly what is wrong and where.

How to Validate a Hostname

  1. Enter the hostname string you want to validate (e.g., web-server-01.example.com)
  2. The tool checks each label against RFC 1123 naming rules
  3. Review the validation result showing pass/fail status and any specific violations found
  4. Fix reported issues and re-validate until the hostname passes all checks

Hostname Validation Examples

InputValid?Reason
web-server.example.comYesAlphanumeric characters and hyphens, proper label structure
my_server.example.comNoUnderscores are not allowed in hostnames per RFC 1123
-server.example.comNoLabels cannot start with a hyphen
server-.example.comNoLabels cannot end with a hyphen
a.b.c.d.e.example.comYesMultiple subdomain levels are permitted
xYesSingle-label hostnames are valid
aaaa...aaaa (64 chars in one label)NoIndividual labels cannot exceed 63 characters
server.example.comNoLeading spaces are invalid characters

When to Use the Hostname Validator

  • Before configuring DNS records to ensure the hostname will resolve correctly across all DNS servers
  • Validating user input in web forms or APIs that accept hostnames for service configuration
  • Auditing configuration files (nginx, Apache, hosts files) for typos and invalid entries
  • Pre-checking hostnames for TLS certificates to avoid certificate signing request rejections
  • Troubleshooting DNS failures when a hostname that looks correct refuses to resolve
  • Migrating DNS zones to catch invalid entries before importing into a new provider

How RFC 1123 Hostname Rules Work

RFC 1123 updated the original RFC 952 hostname specification to define the syntax used across the internet today. The rules govern every hostname used in DNS, email, URLs, and network configuration.

Label Rules

Each hostname consists of one or more labels separated by dots. Each label must:

  • Contain only ASCII letters (a-z, A-Z), digits (0-9), and hyphens (-)
  • Start with an alphanumeric character (not a hyphen)
  • End with an alphanumeric character (not a hyphen)
  • Be between 1 and 63 characters long

Total Length Limit

The complete hostname, including dots between labels, cannot exceed 253 characters. This limit comes from the DNS wire format, where each label is preceded by a length byte and the name is terminated with a null byte, giving a maximum of 255 bytes total.

Underscores and Special DNS Names

Underscores (_) are technically invalid in hostnames, though some systems tolerate them. DNS record names like _dmarc.example.com, _sip._tcp.example.com, and _acme-challenge.example.com use underscores by design, but these are DNS names, not hostnames. Regular hostnames that identify hosts on a network must not contain underscores. Many mail servers, TLS certificate authorities, and application frameworks reject hostnames with underscores, so even if your local resolver accepts them, you will eventually hit a system that does not.

Trailing Dots and Absolute Names

A trailing dot (e.g., example.com.) indicates an absolute DNS name, also called a fully qualified domain name. The trailing dot is valid in DNS configuration contexts like zone files and dig queries, but most applications and user-facing configurations do not expect or handle it. Whether a trailing dot makes a hostname valid or invalid depends on the context in which it is used.

Hostname Validation in Practice

The most common hostname mistake in the wild is the underscore. Developers frequently use underscores in server names because they are used as separators in programming. A server named web_prod_01.example.com will work fine for SSH access and even basic DNS lookups on most systems, but it will fail when you try to get a TLS certificate for it. Certificate authorities follow the CA/Browser Forum baseline requirements, which mandate RFC-compliant hostnames. Renaming a production server is painful, so catching this during initial setup saves significant effort later.

Another frequent issue is hostnames that creep beyond length limits. This usually happens with automatically generated names in cloud environments or container orchestration systems. A Kubernetes pod might get a name like my-very-long-application-name-deployment-7b4f8c9d2e-xq9z2.namespace.svc.cluster.local, and if the labels or total length exceed the limits, DNS resolution quietly fails. If you are designing naming conventions for automated infrastructure, validate your longest expected names through this tool before committing to a pattern.

Watch out for invisible characters too. Hostnames copied from documents, emails, or chat messages sometimes pick up non-breaking spaces, zero-width characters, or smart quotes. These are invisible in most editors but immediately fail hostname validation. If a hostname looks correct but fails validation, try retyping it manually rather than pasting.

Frequently Asked Questions

Are underscores allowed in hostnames?

No. RFC 1123 limits hostname characters to letters, digits, and hyphens. While some DNS implementations tolerate underscores, and DNS record names like _dmarc or _sip._tcp use them, standard hostnames must not contain underscores. Many mail servers and TLS certificate authorities reject hostnames with underscores.

What is the difference between a hostname and a domain name?

A hostname identifies a specific host on a network and follows RFC 1123 syntax rules. A domain name is a broader concept within the DNS hierarchy. All hostnames are domain names, but not all domain names are hostnames. For example, _dmarc.example.com is a valid domain name used for DMARC records but is not a valid hostname because it starts with an underscore.

Can a hostname be a single label like localhost?

Yes. Single-label hostnames are valid under RFC 1123. Common examples include localhost, router, and printer. However, single-label hostnames only work within local networks or when a DNS search domain is configured. On the public internet, fully qualified domain names with at least two labels are required.

Is hostname validation case-sensitive?

No. DNS hostnames are case-insensitive per RFC 1123. The labels Server, server, and SERVER are all equivalent. DNS preserves the original case in responses, but comparisons are always case-insensitive.

Why does my hostname fail validation when it works in my browser?

Browsers and operating systems are often more lenient than the RFC specification. A browser might successfully navigate to a hostname containing an underscore because the underlying DNS resolver accepts it, but the hostname is still technically invalid. Other systems like mail servers, certificate authorities, and strict DNS implementations will reject it. Passing this validator means the hostname is universally safe.

What about internationalized hostnames with non-ASCII characters?

Standard hostnames per RFC 1123 only allow ASCII characters. Internationalized domain names (IDNs) use Punycode encoding to represent non-ASCII characters in a DNS-compatible format. The encoded form (starting with xn--) follows hostname rules, but the decoded Unicode form does not. Use the FQDN Validator for checking internationalized domain names.

Related Tools

IPparseβ€’Free Network & Subnet Calculator Tools

Β© 2026 IPparse. All tools run locally in your browser.

100% Privacy-First β€’ No Data Collected