It happened at that time that Judah went down from his brothers and settled near a certain Adullamite whose name was Hirah. There Judah saw the daughter of a certain Canaanite whose name was Shua; he married her and went in to her. She conceived and bore a son; and he named him Er. Again she conceived and bore a son whom she named Onan. Yet again she bore a son, and she named him Shelah. She was in Chezib when she bore him.
Judah took a wife for Er his firstborn; her name was Tamar. But Er, Judah's firstborn, was wicked in the sight of the Lord, and the Lord put him to death. Then Judah said to Onan, "Go in to your brother's wife and perform the duty of a brother-in-law to her; raise up offspring for your brother."
But since Onan knew that the offspring would not be his, he spilled his semen on the ground whenever he went in to his brother's wife, so that he would not give offspring to his brother.
What he did was displeasing in the sight of the Lord, and he put him to death also.
Then Judah said to his daughter-in-law Tamar, "Remain a widow in your father's house until my son Shelah grows up"—for he feared that he too would die, like his brothers. So Tamar went to live in her father's house.
In course of time the wife of Judah, Shua's daughter, died; when Judah's time of mourning was over, he went up to Timnah to his sheepshearers, he and his friend Hirah the Adullamite. When Tamar was told, "Your father-in-law is going up to Timnah to shear his sheep," she put off her widow's garments, put on a veil, wrapped herself up, and sat down at the entrance to Enaim, which is on the road to Timnah. She saw that Shelah was grown up, yet she had not been given to him in marriage.
When Judah saw her, he thought her to be a prostitute, for she had covered her face. He went over to her at the roadside, and said, "Come, let me come in to you," for he did not know that she was his daughter-in-law. She said, "What will you give me, that you may come in to me?" He answered, "I will send you a kid from the flock." And she said, "Only if you give me a pledge, until you send it."
He said, "What pledge shall I give you?" She replied, "Your signet and your cord, and the staff that is in your hand." So he gave them to her, and went in to her, and she conceived by him.
Then she got up and went away, and taking off her veil she put on the garments of her widowhood.
When Judah sent the kid by his friend the Adullamite, to recover the pledge from the woman, he could not find her. He asked the townspeople, "Where is the temple prostitute who was at Enaim by the wayside?" But they said, "No prostitute has been here." So he returned to Judah, and said, "I have not found her; moreover the townspeople said, 'No prostitute has been here.'" Judah replied, "Let her keep the things as her own, otherwise we will be laughed at; you see, I sent this kid, and you could not find her."
About three months later Judah was told, "Your daughter-in-law Tamar has played the whore; moreover she is pregnant as a result of whoredom." And Judah said, "Bring her out, and let her be burned." As she was being brought out, she sent word to her father-in-law, "It was the owner of these who made me pregnant." And she said, "Take note, please, whose these are, the signet and the cord and the staff." Then Judah acknowledged them and said, "She is more in the right than I, since I did not give her to my son Shelah." And he did not lie with her again.
When the time of her delivery came, there were twins in her womb. While she was in labor, one put out a hand; and the midwife took and bound on his hand a crimson thread, saying, "This one came out first." But just then he drew back his hand, and out came his brother; and she said, "What a breach you have made for yourself!" Therefore he was named Perez. Afterward his brother came out with the crimson thread on his hand; and he was named Zerah.