ToolJovia
Developer

Locale Code Converter

Convert locale codes such as en_US → en-US between BCP 47 and a limited underscore form.

✓ Browser-local processing
One code, up to 255 characters before trimming outer ASCII spaces. Controls and non-ASCII input are refused; the original input is preserved in the result.

Loading tool…

How to use Locale Code Converter

Convert en_US to en-US for a web language setting, or inspect the limited underscore spelling of a BCP 47 tag. Review the complete canonical tag, target status and any explicit UTF-8 naming metadata before copying the JSON result.

  1. Select the format your input uses and enter one locale code.
  2. Run the converter, then compare the original input with the complete canonical BCP 47 tag and the limited underscore target status.
  3. Copy the result or download the JSON file. Check the receiving application’s accepted locale format before using it.

Good to know

  • At most 255 UTF-16 code units in the original input, checked before normalization. Only outer U+0020 ASCII spaces may be trimmed; C0/C1 controls, DEL and non-ASCII content are refused.
  • Underscore form supports only a 2–3 or 5–8 letter language, optional 4-letter script, optional 2-letter or 3-digit region, and exact case-sensitive .UTF-8 suffix. C, POSIX, root, @modifiers and other codesets are outside this scope.
  • Original BCP 47 variant, extension or private-use syntax makes the limited underscore target unsupported, even when canonicalization simplifies the tag. The complete canonical BCP 47 result remains visible; no lossy shortened value is emitted.
  • Canonicalization can change aliases or order. It does not guarantee IANA registration, installed locales, translations, POSIX or CLDR compatibility, or Android and Apple platform support. No maximize, minimize or byte transcoding is performed.
  • Conversion happens locally in this tab. Inputs and results are not automatically saved, fetched from a URL, uploaded or added to feedback.

Common questions

What does the converter do with en_US?

With Underscore form selected, it creates a browser-canonical BCP 47 tag such as en-US and a limited underscore result derived from that canonical language, script and region. The original text is kept separately.

Does zh_Hans_CN.UTF-8 install a locale or change a file’s encoding?

No. UTF-8 is retained as naming metadata only. A supported underscore spelling is not proof that a system or application has that locale installed.

Why can a valid BCP 47 tag have an unsupported underscore target?

The narrow target has no place for variants, extensions or private-use information. The converter keeps the full canonical BCP 47 tag and reports that target as unsupported instead of silently dropping information.

Keep going with related tools

All developer →