Accept-Language Header Explained
What the HTTP Accept-Language header does and when it's used.
Published October 13, 2026
Accept-Language states the human languages the user prefers, in priority order, so servers can return localised content.
How it works
Browsers fill it from system settings. Use it as a hint and let users override with an explicit choice.
The Accept-Language header is part of the HTTP message and is case-insensitive in name.
In a real exchange
curl -i https://example.com/
Accept-Language: en-IN, hi;q=0.8, en;q=0.5
Practical examples
The header
Accept-Language: en-IN, hi;q=0.8, en;q=0.5Set or use it in code
const langs = req.acceptsLanguages(['en','hi'])Inspect it
curl -sI https://example.com | grep -i 'accept-language'Common mistakes
- Forcing language based only on this header
- Not providing a language switcher
- Forgetting Vary: Accept-Language
Key takeaways
- Accept-Language: Accept-Language states the human languages the user prefers, in priority order, so servers can return localised content.
- Check it in browser DevTools → Network.
- Test with curl -I before deploying.
FAQ
Is it reliable for locale?
It is a hint, not a guarantee.
Is Accept-Language case sensitive?
Header names are case-insensitive; values may not be.