Flag API & CDN
Free API for flag icons, easy to use in your projects
Quick Start
Use our CDN to display flags on your website. Just need an image tag.
<!-- SVG (recommended, scalable) -->
<img src="https://flagscenter.com/api/v1/es.svg" alt="Spain flag">
<!-- PNG with size -->
<img src="https://flagscenter.com/api/v1/fr/256.png" alt="France flag">
<!-- WebP (better compression) -->
<img src="https://flagscenter.com/api/v1/de/128.webp" alt="Germany flag">
URL Format
# SVG (vector, any size)
https://flagscenter.com/api/v1/{code}.svg
# PNG/WebP with size
https://flagscenter.com/api/v1/{code}/{size}.{format}
# Examples
https://flagscenter.com/api/v1/us.svg # USA SVG
https://flagscenter.com/api/v1/gb/256.png # UK 256px PNG
https://flagscenter.com/api/v1/jp/128.webp # Japan 128px WebP
Parameters
| Parameter | Description | Values |
|---|---|---|
code
|
ISO country code | us, es, fr, de, jp, etc. |
size
|
Size in pixels (PNG/WebP only) | 64, 128, 256, 512 |
format
|
Image format | svg, png, webp |
US States
For US state flags, use the code with US- prefix:
# US States use format: us-{state code}
https://flagscenter.com/api/v1/us-ca.svg # California
https://flagscenter.com/api/v1/us-tx.svg # Texas
https://flagscenter.com/api/v1/us-ny.svg # New York
Examples
https://flagscenter.com/api/v1/es.svg
https://flagscenter.com/api/v1/jp/128.png
Response Headers
Access-Control-Allow-Origin: *
Cache-Control: public, max-age=31536000, immutable
Content-Type: image/svg+xml (or image/png, image/webp)
Limits & Usage
- Free API with no rate limits
- 1 year cache for maximum performance
- CORS enabled for use from any domain
- No authentication required