Formify Docs

MAC Address

Validate MAC addresses in common formats.

MAC Address

Validates that a value is a MAC address (48-bit hardware address). Several standard notations are accepted.

Configuration

Config flagTypeDescription
macAddressbooleanWhen true, requires the value to be a valid MAC address.

With useForm

const form = useForm({
  initialValues: { mac: '' },
  validationSchema: {
    mac: { macAddress: true },
  },
});

With the V builder

import { V } from 'formify-js';

V.macAddress();

Default message

ScenarioMessage
Value is not a MAC addressMust be a valid MAC address

Examples

ValueResult
'00:1A:2B:3C:4D:5E'✅ Valid (colon-separated)
'00-1A-2B-3C-4D-5E'✅ Valid (dash-separated)
'001A.2B3C.4D5E'✅ Valid (dot-separated)
'00:1A:2B:3C:4D'❌ Invalid (too short)
'GG:1A:2B:3C:4D:5E'❌ Invalid (non-hex digits)

Notes

  • Colon, dash, and dot separators are all accepted; the six 2-digit octets must be valid hex.
  • MAC addresses are case-insensitive: '00:1a:2b:3c:4d:5e' passes.

On this page