PB
Available
integration_instructions
lock Free · Private · In-Browser

Socket Address Parser

Parse host and port forms into a canonical socket address.

 

Separate socket hosts from optional ports

A socket endpoint may be written as hostname and port, IPv4 and port, bracketed IPv6 and port, or a raw IPv6 address without a port. This parser distinguishes those forms, validates IPv4 octets or IPv6 hextets, checks host-label syntax, and restricts an explicit port to the integer range 1 through 65535 before printing a canonical endpoint.

The default bracketed value is parsed as host 2001:db8::1, port 443, and IPv6 kind, then returned canonically with brackets. An unbracketed string containing several colons is treated as raw IPv6 without a port because its final hextet is otherwise ambiguous. A single colon separates a hostname or IPv4 address from a port.

Why IPv6 ports require brackets

Parsing does not resolve a hostname, check whether a port is listening, or infer a transport protocol. IPv6 zone identifiers are normalized as address context and may need separate handling by an operating-system API. The endpoint is processed only in your browser. Use brackets whenever an IPv6 literal and port share one string, and validate service configuration independently.

Frequently Asked Questions

Why must IPv6 use brackets when a port is present?

IPv6 already contains colons, so brackets separate the address from the final port delimiter unambiguously.

Does the parser perform DNS resolution?

No. It validates the text form locally and never contacts a resolver or host.

Can a raw IPv6 address include a port without brackets?

No unambiguous distinction exists, so multiple-colon input is treated as an address without a port.

Take it further
All Free Tools

Browse the full set of free, private, in-browser tools.

Learn More arrow_forward