Hyphenated Names: How to Join and Order Surnames

How to combine two surnames with a hyphen, choose which comes first, and clean up dash characters and spacing in name data without changing anything else.

A hyphenated surname joins two family names into one, as in Garcia-Lopez. Most people need to settle two things: which name goes first, and how to write the hyphen so forms, databases and search tools treat the result as one consistent name. This guide covers both, with text examples and commands for cleaning up name data.

What hyphenating a surname does

Hyphenating takes two separate surnames and writes them as a single compound surname. The input is two names, such as Garcia and Lopez. The output is one surname with a hyphen between them and no spaces: Garcia-Lopez. Each part keeps its own spelling, capitalization and accents.

The operation only touches the boundary between the two names. It should not change letters, accents or internal capitalization (McDonald, DeLuca) and it should not split multi-word surnames such as de la Cruz. Joining de la Cruz and Smith gives de la Cruz-Smith. The spaces inside de la Cruz stay.

Which name comes first

No single universal rule sets the order. In the US it is usually a personal or family choice. Common approaches include:

  • One partner's surname first by mutual agreement
  • Alphabetical order, so neither name is favored by default
  • The order that sounds best or is easiest to spell and pronounce
  • A cultural convention the family follows. In traditional Spanish naming, for example, the father's surname customarily comes before the mother's
  • For children, the order the parents choose, often matching a sibling's name for consistency

Gap in the supplied evidence: nothing here confirms the legal requirements, forms or fees for adopting a hyphenated surname in any particular state or agency. Check those with the agency that will record the name before you rely on a specific order or format.

Use the right hyphen character

Several Unicode characters look like a hyphen, but software treats each one as a different character. Garcia-Lopez typed with one of them and Garcia–Lopez typed with another will not match in a search or a duplicate check. Word processors may also replace a typed hyphen with a dash automatically.

Character | Code point | Use in names
Hyphen-minus (-) | U+002D | The standard keyboard hyphen. The safest choice for forms, databases and IDs
Hyphen (‐) | U+2010 | A typographic hyphen. It looks correct but may not match U+002D in searches
Non-breaking hyphen (‑) | U+2011 | Stops a line break at the hyphen in displayed text. It is still a different character from U+002D
En dash (–) | U+2013 | Used for ranges such as 1990–1995. Not correct inside a name
Em dash (—) | U+2014 | Used for breaks in a sentence. Not correct inside a name
Minus sign (−) | U+2212 | Used in math. Not correct inside a name

For stored or submitted names, use the keyboard hyphen-minus (U+002D) with no spaces on either side. If a typeset document must keep the name on one line, you can use a non-breaking hyphen in that document only. Keep the stored version with U+002D so searches still find it.

How to join and order surnames step by step

Before you start

  • Decide the order of the two surnames
  • Confirm the exact spelling, capitalization and accents of each part from an official document
  • If you are editing a file or spreadsheet, work on a copy, or write results to a new column, so the original values stay recoverable
  • Confirm the file is saved as UTF-8 so accented letters and dash characters survive processing

Join two surnames by hand

  • 1. Write the first surname exactly as it appears
  • 2. Type the keyboard hyphen (U+002D) with no space before or after it
  • 3. Write the second surname exactly as it appears
  • 4. Check that autocorrect has not turned the hyphen into a dash

Example input: first surname "de la Cruz", second surname "Smith". Expected output: "de la Cruz-Smith". Typing "de la Cruz - Smith" with spaces around the hyphen is the most common mistake.

Join and reorder surnames in Python

This illustrative Python snippet joins surnames in the chosen order and can swap the order of an existing hyphenated surname. It splits only on the hyphen, so multi-word parts like de la Cruz stay intact. It also applies NFC normalization. That makes an accented letter stored as one character and the same letter stored as a base letter plus a combining accent compare as equal. The snippet has not been run as part of this guide.

import unicodedata

def join_surnames(*parts):
    cleaned = [unicodedata.normalize("NFC", p.strip()) for p in parts]
    return "-".join(cleaned)

def swap_order(hyphenated):
    first, second = hyphenated.split("-", 1)
    return join_surnames(second, first)

print(join_surnames("de la Cruz", "Smith"))   # expected: de la Cruz-Smith
print(swap_order("Garcia-Lopez"))              # expected: Lopez-Garcia

The split uses a limit of 1 so only the first hyphen is treated as the boundary. If either original surname already contains a hyphen, check the split point manually. The code cannot tell which hyphen separates the two family names.

Clean up dash variants and stray spaces in a name list

Imported name data often mixes dash characters and spacing, as in "Garcia – Lopez" or "Garcia -Lopez". The Perl command below is illustrative. It reads a UTF-8 file with one surname per line. It replaces U+2010 through U+2015, U+2212 and the plain hyphen-minus, along with any surrounding whitespace, with a single U+002D. The -CSD option tells Perl to treat input and output as UTF-8. Without it, the multi-byte dash characters will not match.

perl -CSD -pe 's/[ \t]*[\x{2010}-\x{2015}\x{2212}-][ \t]*/-/g' surnames.txt > surnames_clean.txt

Example input line: "Garcia – Lopez" (en dash with spaces). Expected output line: "Garcia-Lopez". The pattern matches only spaces and tabs around the dash, not newlines, so each name stays on its own line. Output goes to a new file, so the original is preserved.

Scope caution: run this only on a file or column that holds surnames. On full records or free text it would also rewrite date ranges such as "1990–1995" and sentence dashes, which changes their meaning.

Check the result

After cleaning, search for any remaining non-standard dashes and for spaces next to a hyphen. With GNU grep in a UTF-8 locale, these illustrative commands print the matching lines with line numbers. No output means none were found.

grep -nP '[\x{2010}-\x{2015}\x{2212}]' surnames_clean.txt
grep -nP ' -|- ' surnames_clean.txt
  • Compare line counts of the original and cleaned files. They should be identical (for example with wc -l)
  • Spot-check names with accents, particles (de, van, O') and internal capitals to confirm they did not change
  • Diff the two files to review every change before replacing the original

Sorting and searching hyphenated surnames

Alphabetical lists usually file a hyphenated surname under its first part, so Garcia-Lopez sorts under G. Style guides and institutions differ, though, so follow the convention your organization uses. Simple byte-order sorting treats the hyphen as a character that comes before letters. Locale-aware sorting may ignore it. The same list can therefore come out in a different order depending on the tool.

For lookups, a search for Lopez may not find Garcia-Lopez if the system matches whole fields only. Searching each part separately, or matching on the part before or after the hyphen, makes hyphenated records easier to find.