Skip to main content
CalcHive

Regex for IPv6 Address

Matches full IPv6 addresses in standard notation (8 groups of 4 hex digits separated by colons).

Pattern

/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/

Pattern Breakdown

TokenExplanation
^Start of string
(?:[0-9a-fA-F]{1,4}:)1-4 hex digits followed by colon
{7}Repeat 7 times (first 7 groups)
[0-9a-fA-F]{1,4}Final group of 1-4 hex digits
$End of string

Test Examples

InputMatch?
2001:0db8:85a3:0000:0000:8a2e:0370:7334Match
fe80:0000:0000:0000:0000:0000:0000:0001Match
::1No match
192.168.1.1No match

Common Use Cases

  • IPv6 address validation
  • Network configuration
  • DNS record validation

Variations

^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$

Allows compressed notation with ::

Want to test this pattern with your own data?

Open the Regex Tester