how do you

Love yourself? I get days where I'm like fuck yes I look hot I love my body then I see other girls and compare myself to my boyfriends ex I know I'm better but it's just my stupid thoughts getting to me. I'm confident when I want to be. But I just hate the fuck out of myself and can't tell myself I'm good enough etc. how do u come to love yourself and not compare yourself to others.