A fund is a pot of money from many investors, run as one portfolio. Instead of buying forty shares yourself, you buy a slice of a fund that owns them, and your slice rises and falls with the whole. That idea is old and simple. What makes the subject confusing is that the names people use mix up two separate questions: how the fund is built, and what it invests in.
'Index fund' answers the second question. It means a fund that tries to copy a market index, holding the same shares in the same proportions, rather than trying to beat it. 'Mutual fund' and 'ETF' answer the first question. They are wrappers: legal structures with rules about how you buy and sell. An index fund can come in either wrapper. So can an actively managed fund. Keeping the two questions apart clears up most of the confusion.
