Need to validate MAC addresses in your application? This guide covers everything you need to know about MAC address validation via API, including different formats, OUI lookup, and implementation examples in multiple languages.
What is a MAC Address?
A MAC (Media Access Control) address is a unique identifier assigned to network interface controllers (NICs) for use as a network address. MAC addresses are 48 bits (6 bytes) long and are typically expressed as 12 hexadecimal digits.
A typical MAC address looks like this: 00:1A:2B:3C:4D:5E
MAC Address Formats
MAC addresses can be represented in several formats:
Colon-Separated (Unix/Linux)
Six groups of two hex digits separated by colons: 00:1A:2B:3C:4D:5E
Hyphen-Separated (Windows)
Six groups of two hex digits separated by hyphens: 00-1A-2B-3C-4D-5E
Dot-Separated (Cisco)
Three groups of four hex digits separated by dots: 001A.2B3C.4D5E
Using the MAC Address Validator API
TinyFn provides a simple endpoint to validate MAC addresses:
GET https://api.tinyfn.io/v1/validate/mac?address=00:1A:2B:3C:4D:5E
Headers: X-API-Key: your-api-key
{
"valid": true,
"mac": "00:1A:2B:3C:4D:5E",
"format": "colon",
"oui": "001A2B",
"manufacturer": "Ayecom Technology Co., Ltd.",
"is_unicast": true,
"is_local": false
}
Parameters
| Parameter | Type | Description |
|---|---|---|
address |
string | MAC address to validate (required) |
Code Examples
JavaScript / Node.js
const response = await fetch(
'https://api.tinyfn.io/v1/validate/mac?address=00:1A:2B:3C:4D:5E',
{ headers: { 'X-API-Key': 'your-api-key' } }
);
const result = await response.json();
console.log(result.valid); // true
console.log(result.manufacturer); // "Ayecom Technology Co., Ltd."
Python
import requests
response = requests.get(
'https://api.tinyfn.io/v1/validate/mac',
params={'address': '00:1A:2B:3C:4D:5E'},
headers={'X-API-Key': 'your-api-key'}
)
result = response.json()
print(result['valid']) # True
print(result['manufacturer']) # "Ayecom Technology Co., Ltd."
cURL
curl "https://api.tinyfn.io/v1/validate/mac?address=00:1A:2B:3C:4D:5E" \
-H "X-API-Key: your-api-key"
Common Use Cases
- Network Management: Validate MAC addresses in network configurations
- Device Registration: Verify MAC addresses during device onboarding
- Access Control: Validate addresses for MAC-based authentication
- Asset Tracking: Identify device manufacturers in inventory systems
- Security: Detect potentially spoofed or invalid MAC addresses
Best Practices
- Accept any format: Normalize input from colons, hyphens, or dots
- Store consistently: Use a single format (typically colon-separated) in databases
- Validate OUI: Check if the manufacturer is recognized
- Check unicast/multicast: Verify the address type matches your use case
Use via MCP
Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:
{
"mcpServers": {
"tinyfn-validate": {
"url": "https://api.tinyfn.io/mcp/validate/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
See all validation tools available via MCP in our Validation MCP Tools for AI Agents guide.
Try the MAC Address Validator API
Get your free API key and start validating MAC addresses in seconds.
Get Free API Key