Nail biting

How do I stop nail biting? I used to when I was young but stopped for a long time and had beautiful long nails, but ever since I became really depressed and anxious I have been nail biting all the time. Sometimes I bite them down so much they bleed.. it’s gross and looks ugly, I can’t paint my nails cause I barely have any. I’ve tried putting nail polish on it to stop but I will still bite anyway. I do it without thinking :(