How to use é è e for spelling wise?

I know the pronunciations but for spelling, is there any rules to spell it correctly? For example “préférence” , “préfère”, it is just confusing. There is no way I can mermoise al these. I know the first e is usually é.