The 37-year-old reality TV star and rapper husband Kanye West are expecting via a surrogate their third child.
The couple has been keeping quiet about the baby's gender but Kardashian let the cat out of the bag during an appearance on Ellen DeGeneres' chat show.
Kardashian accidentally revealed her secret as she was explaining that the cherry blossom-themed baby shower she held at the weekend was partly for the benefit of her four-year-old daughter North.
Kim Kardashian told Ellen DeGeneres she's having a girl
Kim Kardashian SPILLS OUT of boob-baring Madonna costume
Kim Kardashian goes braless to flash extreme cleavage in racy ensemble
She said: "I thought I really do want to have a baby shower, because I want her to feel that something's coming, and for her to really understand it.
"So people brought toys and gifts, and she was opening them all up the next day and she said 'Mum, you know since baby sister is not here, I think I need all of her toys in my room, and I'll play with them and make sure they are all okay for my baby sister'."
When DeGeneres pointed out that Kardashian had spilled the beans about the gender, the star smiled and confirmed the news.
Kim's surrogate is thought to give birth at the end of the year
Kim Kardashian sexiest pictures
Tue, November 7, 2017
Kim Kardashian in her sexiest pictures.
1 of 100
Kim Kardashian ditches bra at LACMA Gala
The couple is also parents to son Saint, who turns two in December.
Kardashian suffered with placenta accreta, where the placenta grows into the muscle of the uterus, in her pregnancies and has previously said that doctors advised her not to risk carrying a third child.
Her surrogate is thought to be due to give birth towards the end of the year.