It really depends on your needs.
If gaming (and at 1080p or 1440p) and i5 will suffice. At 4K, an i7 get's called in a little more. If editing/rendering etc, then the i7 makes sense.
Between the 6400, 6500 or 6600 I'd recommend the 6500 in 99% of situations. The clock speed gains vs the 6400 justify the slight cost increase, whereas the 6600 is overpriced (generally) for what it is.
IMO, the only 'viable' i5's that are worth investing in are the 6500 or 6600K.
If you're considering the 6400, the i3-6100 is likely the better option.
If you're considering the 6600, then the 6600K is a smarter move (along with a Z170 board + cooler). Even if you have no desire to OC, there's a little clock speed/boost gain, and the option remains to OC in future to extend the viable lifespan of the CPU....