Cancellation fees will be 25% of the total cost paid if you cancel a confirmed ticket with fewer than 48 hours to go but more than 12 hours before the train's planned departure (subject to a minimum flat cancellation penalty).
There is a minimum fixed cancellation fee for each class, but cancellation fees will be 50% of the entire cost paid if you cancel a confirmed ticket with fewer than 12 hours to go and up to 4 hours before the train's planned departure.
You still have the choice to cancel a rail ticket if it is either RAC or in the waiting list. No matter how far you're traveling, just make sure you do this at least 30 minutes before the train is scheduled to depart.
Also Read | How to change your train ticket boarding station online via IRCTC?