The term derives from Middle Iranian terms xvatay, xwadag meaning "lord", "ruler", "master", appearing in written form in Parthian kwdy, in Middle Persian kwdy, and in Sogdian kwdy. It is the Middle Persian reflex of older Iranian forms such as Avestan xva-dhata- "self-defined; autocrat", an epithet of Ahura Mazda. The Pashto term Xdāi (خدۍ) is either a Persian loanword or an Eastern Iranian cognate.
Prosaic usage is found for example in the Sassanid title katak-xvatay to denote the head of a clan or extended household or in the title of the 6th century Khwaday-Namag "Book of Lords", from which the tales of Kayanian dynasty as found in the Shahnameh derive.
Semi-religious usage appears, for example, in the epithet zaman-i derang xvatay "time of the long dominion", as found in the Menog-i Khrad. The fourth and eighty-sixth entry of the Pazend prayer titled 101 Names of God, Harvesp-Khoda "Lord of All" and Khudawand "Lord of the Universe", respectively, are compounds involving Khuda. Application of khuda as "the Lord" (Ahura Mazda) is represented in the first entry in the medieval Frahang-i Pahlavig.
The phrase Khuda Hafiz (meaning May God be your Guardian) is a parting phrase commonly used in Persian, Kurdish, Bengali, Urdu and Pashto, as well as in Hindustani and Punjabi among South Asian Muslims.