Yes. Fasting is required so that the gallbladder fills with bile and expands, which makes stones and wall changes far easier to see. Eating beforehand empties the gallbladder and can make the scan unreliable. Exact instructions are given when you book.
