That depends on how long you have to idle.
While it does take fuel to idle, it also takes fuel to restart the engine.
And you also have to keep shifting into park to restart the engine and then shift into drive to move.
I wouldn't turn off my engine while waiting for a traffic light to change.
Years ago I was on the freeway and there was an accident that blocked both lanes. It was far enough ahead of me that I could not see the accident. After sitting for a few minutes without moving, a lot of the drivers started turning off their engines and headlights. Eventually there were quite a few of us getting out of our cars and gathering to chat, and of course the primary topic was why we were stopped. We were there for over 30 minutes before we saw vehicles ahead of us in the distance start to move.