Where the hymn comes from
The hymn is part of the Devi Mahatmya, the Sanskrit text also called the Durga Saptashati or Chandi. It has 13 chapters and about 700 verses, which is how it gets the name Saptashati, "seven hundred". Printed editions count short utterances and half verses in slightly different ways, so the exact number varies a little between books. The text forms a section of the Markandeya Purana. In the numbering most often cited it is chapters 81 to 93, and in another well-known printed edition it is chapters 78 to 90. The Purana as a whole is usually assigned to roughly the fourth to sixth century CE, though the date of any ancient text is a matter of scholarly estimate and not of record.
The Devi Mahatmya is divided into three episodes. In the first, chapter 1, the Goddess is shown as Mahakali in the story of Madhu and Kaitabha. In the second, chapters 2 to 4, she is Mahalakshmi and defeats the buffalo demon Mahishasura. In the third, chapters 5 to 13, she is Mahasaraswati and faces the demons Shumbha and Nishumbha with their generals. Ya Devi Sarvabhuteshu belongs to chapter 5, the opening chapter of this third episode. It is not part of the Mahishasura story, a point that is often mixed up because both episodes are read during Navaratri.
The story behind the hymn
In the story, the demons Shumbha and Nishumbha have driven the gods out of heaven. The gods go to the Himalayas, to the bank of the Ganga, where they praise the Goddess. The praise they offer is the hymn on this page. One edition describes the chapter as the dialogue between the Goddess and a messenger sent by Shumbha, in which the praise by the gods is a long section of the chapter, and some printed editions call this section the Aparajita Stotra.
The setting explains the mood of the hymn. It is not a boast or a request for riches. It is the cry of beings who have lost their position and turn to the power that holds the world together. The gods do not describe battle tactics. They name the Goddess again and again as something that is already present in every living creature, and they bow.
The five opening stanzas
The text on this site begins with five stanzas that come before the famous refrain. They bow to the Goddess in her gentle and her terrible forms: Devi and Mahadevi, Prakriti, the fierce one, Gauri, the moonlight, the one who supports the world. Stanza 3 salutes Kalyani, Vriddhi and Siddhi, meaning welfare, growth and attainment, and also Nairriti and Sharvani. Stanza 4 names Durga, whose name suggests one who carries a person across difficulty, and also Khyati, Krishna and Dhumra. Stanza 5 describes her as both exceedingly gentle and exceedingly fierce. The point of this opening is that the same Goddess holds both qualities.
The refrain and what it names
After the opening, the hymn settles into a pattern. Each stanza begins "Ya Devi Sarvabhuteshu", which means "the Goddess who in all beings", then names a form, and the second line is always the same: "Namastasyai namastasyai namastasyai namo namah", a fourfold bow to her. In the text given on this site there are 21 of these stanzas.
The forms named are Vishnumaya, the divine power that holds the world in its spell; consciousness; intellect; sleep; hunger; shadow; power; thirst or craving; forbearance; birth or kind; modesty; peace; faith; radiance; prosperity, in the form of Lakshmi; livelihood or activity; memory; compassion; contentment; the mother; and delusion. Some of the words can be translated in more than one way. Chhaya can mean shadow or reflection, jati can mean birth or the kind of thing a being is, and vritti can mean livelihood, activity or the movement of the mind. This site gives one reading in the meaning column and notes that others exist.
What stands out in the list is that it includes hunger, thirst and delusion beside peace and compassion. The hymn does not limit the Goddess to pleasant qualities. It says that the force at work in the whole of experience, including its hard parts, is the one being. This is the idea a reader should take away: the Goddess is not far off in a heaven, but is the intelligence, appetite, rest and confusion of every ordinary day.
The last two stanzas
Stanza 27 says that she presides over the senses of all beings and is always present in all the elements. The word vyapti in it means pervading. Different editions split the compound in the last line differently, writing vyaptyai devyai in one and vyaptidevyai in another, but the meaning is the same: the Goddess of all-pervasion.
Stanza 28 closes the sequence by saying she stays pervading this whole world in the form of consciousness, chiti. After this the longer chapter continues with more verses and the story moves on. Many printed recitations stop at this point, which is why the hymn on this site ends here.
A common mix-up with the Devi Sukta
Some pages call this hymn the Devi Suktam. In the Chandi Path tradition the name is used for it, but it is a different text from the Devi Sukta of the Rigveda, which is a short hymn in the tenth book in which a speaker identifies herself with the power behind the world. If you read a verse labelled Devi Sukta, check which one it is before comparing translations.
A simple way to read it
Read the English meaning of one stanza at a time, then say the Sanskrit slowly. The refrain is easy to learn because only the middle word changes. Many learners find that after a week of reading three or four stanzas each morning they can say the whole hymn from memory. As with any prayer, reciting it is a devotional practice and does not promise any particular result.