There is no contradiction between Jesus’ dying for the whole world and John’s apparent assertion that He came only for those whom the Father had given him. John:3:16 very eloquently states that the Father gave His Son for the entire world that “whosoever believeth should not perish.” Sadly, however, even though everyone would have the opportunity, not everyone would take advantage of the same. As John stated earlier, “He came unto his own, and his own received him not. But as many as received him, to them gave he power to become the sons of God, even to them that believe on his name” (John:1:11–12).
"For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."