I remember I was confused too about this when I was young. Heres a list
Men
Mahrams:-
- Wife
- Father’s wives (Mother, Step mothers)
- Mothers and above (i.e. grandmothers, great grandmothers etc, maternal or paternal)
- Daughters and below (i.e. granddaughters, great granddaughters, etc, step daughter (only after the couple have consummated)
- Sisters (Real sister, Half sisters)
- Aunts (Paternal/Maternal, their half sisters)
- Nieces (Daughters of brother/sister and any half/ daughters)
- Foster* Mother (A lady by whom one was breast fed before the age of two)
- Foster* Sister (A female who was breastfed by the same lady as one was)
- Mother-in-law and above (i.e. grandmother-in-law, great grandmother-in-law etc, maternal or paternal)
- Daughter-in-law and below (i.e. son’s wife, grandson’s wife etc)
The women listed above are women he is not allowed to marry (exception of wife) therefore his mahram, any woman not mentioned are listed as ghayr mahram. Some women are temporarily a mahram, i.e a man can not marry his sister in law, but if his wife passes away, then that restriction is lifted, he is now able to marry.
Women
Mahrams:-
- Husband
- Step father (with the condition that both stepfather and one’s mother have consummated)
- Fathers and above (grandfathers, great grandfathers etc, maternal or paternal)
- Sons and below (grandsons, great grandsons, step sons)
- Brothers (real brothers, half brothers)
- Uncles (Paternal/Maternal, their half brothers)
- Nephews (Sons of brother/sister and any half daughters)
- Foster son (i.e. a boy who a lady has breastfed before the age of two)
- Foster Brother (i.e. a male who was breast fed by the same lady as one was)
- Father-in-law and above (i.e. grandfather-in-law, great grandfather-in-law etc, maternal or paternal)
- Son-in-law and below (i.e. daughters husband, granddaughters husband etc)
Similarly as men, The men listed above are men he is not allowed to marry (exception of husband) therefore his mahram, any man not mentioned are listed as ghayr mahram.
*Foster: Milk mothers who nursed you before the age of two. Whoever is made forbidden through genealogical relation is forbidden through fosterage. In simple terms, one’s foster mother is like one’s mother and her children become one’s foster brothers and sisters and her father becomes one’s foster grandfather and similarly all those types of people normally forbidden are also forbidden in fosterage (i.e. foster father/mother, foster brother/sister, foster uncle/aunt, foster daughter/son etc).
** A half brother or sister shares one parent biologically. A step brother or sister is where 2 people who already have kids, marry, there is no blood relation.
Source