Pig Latin

Translate your text into Pig Latin by adding an ‘ay’ syllable to the end of each word, with special rules for vowels and consonant clusters.

Face with waiting expression Nothing to see yet!

Loading takeymakey...
TakeyMakey code
Want this tool to do something else? Edit the code below and make it do whatever you want.
({
  make: (text) =>
    text
      .split(/\b/g)
      .map((word) => {
        if (!/[a-z]/.test(word)) return word

        let [front, back] = /^([aeiou]|[^aeiou]+$)/i.test(word)
          ? [word, "yay"]
          : [word.match(/[aeiouy].*$/i)[0], word.match(/[^aeiouy]+/i)[0] + "ay"]

        if (/[A-Z]/.test(back[0])) {
          back = back[0].toLowerCase() + back.slice(1)
          front = front[0].toUpperCase() + front.slice(1)
        }

        if (back[0] === "y" && front.slice(-1)[0] === "y") {
          back = back.slice(1)
        }

        return front + back
      })
      .join(""),
})