The correct form is “door-to-door” when used as an adjective or adverb, as in:
- “He works as a door-to-door salesperson.”
- “The campaigners went door-to-door to gather signatures.”
Use “door to door” without hyphens when it’s part of a prepositional phrase or doesn’t modify a noun:
- “They traveled from door to door asking for donations.”
Hyphenation typically applies when words function together to modify another word.