Wash and trim beans and cut to 4-inch lengths.
In each sterile pint jar place 1 to 2 dill heads and, if desired, 1 garlic clove.
Pack beans upright, leaving 1/2-inch headspace. Trim beans if needed.
Combine salt, vinegar, water, and optional pepper flakes and bring to a boil.
Pour hot solution over beans, leaving 1/2-inch headspace. Remove air bubbles, wipe rims, and apply lids.
Process pints 5 minutes at 0–1,000 ft, 10 minutes at 1,001–6,000 ft, or 15 minutes above 6,000 ft.