Regex for IPv4
Match IPv4 addresses with regex.
Last updated: 2025-03-02
Match IPv4 addresses with regex. Use this tool whenever you need to work with regular expressions quickly.
All processing runs in your browser — your data is never sent to our servers. No sign-up required.
Use the fields below to enter your input, adjust any options, then copy or download the result.
How to use
- Enter or paste your input in the field below.
- Adjust options if the tool supports them.
- Copy or download the result as needed.
Pattern
/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/IPv4 address: four octets 0-255 separated by dots.
Example valid
- 192.168.1.1
- 0.0.0.0
- 255.255.255.255
Example invalid
- 256.1.1.1
- 1.2.3
- abc.def.ghi.jkl
Try it
1 match(es): "192.168.1.1" @ 0