I don't actually 'build' encounters myself, but this is how it works...
The DMG says a lot about this. Check the paragraph on Party Size, DMG pg 82. If a party has 6+ PCs then you multiply monster XP by 0.5 to set the budget. If you want a Medium challenge for 8 level 6 PCs then your budget is 600x8=4800 xp; with single monster's XPV multiplied by 0.5, ie you need a monster worth at least 9600 XP. Per DMG page 275 you need a single CR 13 monster (XPV 10,000) to provide a Medium challenge to the group.
Note that a Medium challenge is one that the group is expected to do 6-8 of between long rests, not something that will feel like a big fight. A Hard challenge for eight level 6 PCs has a budget of 900x8=7200 xp, single monster x0.5 so need 14400 xp. Per DMG page 275 you need a single CR 16 monster!