The actor also tells of a NSFW moment he had in traffic while heading to the doctor's office.
Dax Shepard says two daughters are enough for him and wife Kristen Bell.
On Wednesday's Jimmy Kimmel Live!, the former Parenthood star revealed that he got a vasectomy after Bell had a pregnancy scare. "Last year, my wife was working in Atlanta. We were there and she all of a sudden goes, 'Oh, my gosh! I'm so stupid. I've been sick for 10 days and ignoring it; I'm definitely pregnant,'" Shepard recalled. "And I was like, 'We're going to turn into Jon & Kate Plus 8 or something. We already have no life! This is going to be not worth living.' I freaked out."
WATCH: Kristen Bell Says Her Kids 'Could Care Less' About Frozen
The 41-year-old actor remembered waiting eight hours for his wife to get off of work before she could take a pregnancy test. "For eight hours I was like imagining my life with all these kids," he quipped, adding that it was a false alarm.
That's when he became a man of action. "That was Tuesday. I flew home Wednesday for a meeting. Thursday morning I had a vasectomy," he revealed. "I had a vasectomy and Kristen was not thrilled that I did it so quickly."
WATCH: Kristen Bell and Dax Shepard Made an Adorable Music Video of Their Visit to Africa
Shepard also shared a TMI story about how he came to gather his sperm sample for a routine checkup following his vasectomy. "What you have to do when you get a vasectomy is about three weeks later you have got to take your semen in to make sure that it's worked; they test it to make sure that the semen's actually sterile or not," he explained. "They don't provide an area there at the urology clinic to service yourself, so you have to bring in a sample.
The former Jackass star revealed that he ran out of time to "procure" his sample so he ended up having to get it done while in traffic. "I brought a Mason jar with me that I rinsed with extra hot water -- sterile, I think," he joked. "This is the God's truth. I had to drive cross-town, rush hour -- thank God there was heavy traffic on Laurel Canyon, so it slowed down enough that I could [multitask]. I literally masturbated on Laurel Canyon in heavy traffic. It's one thing to loosey-goosey just go for it, but I have a jar and it's heavy traffic. It's very curvy. For those of you have not been on Laurel Canyon, it's one of the twistier roads in America. It's hard enough to get through that road while not making love to yourself, into a container."
Shepard added, "Anyways, the great news is I'm sterile!"
In November, Bell opened up about to ET about the ups and downs of her marriage. "Our relationship wasn't perfect," the 35-year-old actress said. "We had a couple years of fighting and of growing pains and hating each other, then loving each other and going to couples therapy and we worked it out ... We earned each other."