X12 837P N401 (City Name): Format, Values, and Testing Notes
N401 looks like the simplest field in the whole address block — it's just a city name — which is exactly why it's the one people stop paying attention to when building test data, right up until a downstream system expects it to match a real ZIP code.
N401 is the first element in the N4 segment of an X12 837P claim, carrying the free-text city name for the address the segment describes. It has no code list; any string within the standard field-length limit is technically valid.
What populates this field in practice
Example
N401 value DENVER pairs with the CO state code and 80202 ZIP that follow it in this synthetic billing provider address.
Where this trips people up
Because N401 has no enumerated values to validate against, teams often assume it needs no testing at all and generate it from a short, tidy list of well-known city names. That misses two real failure modes: multi-word or hyphenated city names that break naive string-splitting logic, and city names that don't actually correspond to the state and ZIP sitting next to them in the same segment. A parser that never sees a mismatched or unusual city name in testing has no way to know how it behaves when one shows up in production.