Reference·N4 Segment·N401
X12 837P Reference

X12 837P N401 (City Name): Format, Values, and Testing Notes

Jul 28, 2026 · 4 min read
N402 →

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.

Quick answer

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

Format
Free-text string — no HIPAA code list constrains N401, unlike N402 or N403
Typical source
Provider or subscriber address — pulled from the same address record as the N3 street line directly above it
Length
Up to 30 characters — long city names can be truncated by systems enforcing a stricter internal limit

Example

Synthetic example Generated by Synthibase
N4*DENVER*CO*80202

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.

X12 837P N4 Segment Guide: Fields, Format, and Testing Gotchas
What Is X12 837P? The Complete Guide
How to Validate X12 EDI Files Before Payer Submission
Test address fields that stay internally consistent
Synthibase generates synthetic 837P address blocks where city, state, and ZIP are drawn from the same real-world record, including the messy multi-word city names that simple test generators tend to skip.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.