Welcome to HealthcareMagic
Painless blood loss during passing stools is most commonly due to a condition called hemorrhoids in the anus.it is bleeding from engorged blood vessel due to pressure of defecation. But it is possible in other conditions like infection ,anal fissure
etc. It is best to get examined by a doctor since early treatment can prevent complications.till then try to avoid constipation
and have fibre rich diet and plenty of water.