There's no specific length. There really isn't. It's all about your positioning. Look at the main hanging megathread. If you go on your knees and attach it to a basement beam,you'd need more length..maybe 7-8 ft. But knees position isn't recommended.
I know that the fact you're on this website asking this question obviously means you're suicidal. But how long have you felt this way? Are you sure you want to end it? Just please don't act on something you've only felt for a month. Please make sure that you're of sound mind before you do something irreversible. You could try talking to your parents or friends. Try a therapist. Maybe meds that increase serotonin. I completely understand suicide though. I'm not judging you.
Keep in mind that hanging is risky. There's risk of Brain damage if you fail...most commonly if you're found before brain death. A lot of times it takes 8 to 20 min for the brain to die(if done right). After the 4 minute mark(average) your brain cells are said to die by the millions. If you're found at say,6 minutes,you could have major brain damage and possibly even be quadriplegic. Paralyzed 100%. Unless your family or power of attorney does you mercy,you're in for many possible years of AGONIZING HELL. There's a case of this In the UK. He couldn't move at all for like 2 years. Last I heard,he can now move his eyes..only his eyes to communicate,by mostly blinking. Please be careful. Ensure you're home for at least 30 min worse case from when you pass out. Preferably more than an hour.
If you need to talk at all,I'm here for you. I mean it.