Mon 14 September 2026

Shell Script Reference for NATO Phonetic Alphabet

Posted by Al Sweigart in misc   

If you've ever had to spell something out over the phone by saying, "D as in Dog", you've reinvented the NATO Phonetic Alphabet. This is an international standard set of words for letters in cases where you are likely to be misheard. Every now and then I like to practice it by reading out words using it. I'd always look up the Wikipedia page for a reference but I wanted an easy, offline reference as well. I generated simple shell scripts for macOS, Windows, and Linux so that when you enter nato into a terminal window, you get a reference. You can also give the scripts text to spell out as well: nato foo produces Foxtrot Oscar Oscar.

The alphabet reference that it prints is:

A  Alfa      N  November
B  Bravo     O  Oscar
C  Charlie   P  Papa
D  Delta     Q  Quebec
E  Echo      R  Romeo
F  Foxtrot   S  Sierra
G  Golf      T  Tango
H  Hotel     U  Uniform
I  India     V  Victor
J  Juliett   W  Whiskey
K  Kilo      X  X-ray
L  Lima      Y  Yankee
M  Mike      Z  Zulu

Place the script in a folder listed in your PATH environment variable. For the macOS and Linux scripts, you'll need to run chmod +x nato.zsh and chmod +x nato.sh, resepectively, to make them executable. You may also want to rename them simply to nato so you don't have to enter the .zsh or .sh file extension. (On Windows, typing the .bat extension is optional; typing nato will run nato.bat.)

There are some other similar terminal commands have features like customizable text for the word separators, printing in all uppercase or lowercase. I found this unnecessary for my needs and realized I didn't even want an actual program: a shell script was enough, wouldn't need compiling, and would be easier to install.

This is just a quick command for folks who spend a lot of time interacting with the command line and would like a quick reference for the NATO alphabet. I don't expect this is a wide audience, but I wanted to share it nonetheless.


Check out other books by Al Sweigart, free online or available for purchase:

...and other books as well! Or register for the online video course. You can also donate to or support the author directly.