The DMG talks about how to do this, but I've found that it needs some tweaking to be really effective.
What level should an encounter be?
DMG 56 says:
An easy encounter is one or two levels lower than the party’s level.
A standard encounter is of the party’s level, or one level higher.
A hard encounter is two to four levels higher than the party’s level.
Notice that it says nothing about how many characters are in the party. That part of the encounter building is factored in later.
In practice, I found that encounters underneath the party's level weren't very interesting. And for Big Bad Boss Fights, I'd pump the encounter up to five levels above the party.
Does this mean my monsters will be that level?
No. While the 4e developers (through the DMG and the adventure modules) make it clear that they think a variety of levels are good for monsters, I found that it's best to make every monster the same level as the party. Higher-level monsters don't get hit, which makes fights take longer in a very frustrating way; lower-level monsters don't get to hit the party, which makes fights non-threatening.
Keep your monsters at the party's level, and use the Minion/Standard/Elite/Solo "roles" to determine how challenging an individual monster should be. If it's a boss, don't make it four levels higher; make it an Elite of their level.
So what does "encounter level" mean if all my monsters are the party's level?
DMG 56 has a table you should learn to love: Experience Point Rewards. Use it to look up how much experience a Standard monster of the encounter's level is worth, multiply that by the number of players in the party, and you get what's called an encounter budget: it tells you how much XP you need to spend on monsters in order to make an encounter of that particular level, for that particular size of group.
Say you want to make a challenging encounter for your level 4 PCs. How about one level higher than the party? That's level 5, and a level 5 Standard monster is worth 200 XP. You've got six players, so 6 x 200 = 1,200 XP. That's your encounter budget.
Now let's choose some monsters!
You've got 1,200 worth of XP, and you're spending it on level 4 monsters. You don't have to spend exactly that much, but we're aiming for a ballpark of ~1,200 XP worth of monster.
At level 4, a Standard is worth 175, a minion is 44, an Elite is 350, and a Solo is 875.
So you could throw seven Standard monsters (7 x 175 = 1,225) at the party for a decent brawl: there'll be just slightly more than one monster per PC.
Or 27 Minions (27 x 44 = 1,118) but then their turn takes forever to resolve and everyone will probably get bored... or the wizard casts two dailies and wipes the board in the second round.
How about two Elites and three Standards? (2 x 350 = 700, 3 x 175 = 525, 700 + 525 = 1225) Now the party slightly outnumbers the opposition but a couple of the enemies are tougher: variety is the spice of life, and makes encounters much more interesting!
What if I just want them to fight one big monster?
Well, that's a problem, because a level 4 Solo isn't going to fill up your encounter budget. So we cheat.
One Solo and seven Minions (875 + 7 x 44 = 1,183) doesn't look like a boss fight on paper, but Minions don't have to be minions. Hyena spirits raised by the gnoll priest you're fighting, suits of armor animated by an evil paladin, and sparks of star-stuff summoned from the Far Realm by a warlock, all can be represented as Minions without changing the feel that the fight is a solo encounter.
And frankly, you'll find as the party levels up that fighting a single monster is the easiest thing to give them: piling status effects on a single target to cripple it makes one-monster fights trivial. There are ways to make solo creatures work on their own, but that's niche enough that if you're interested you should make it a separate question.
Don't feel bound by the rules.
I don't find the standard DMG practices to be perfectly effective, and I've said some of the changes I make to the practices when I use them. But even beyond that, every group is different. Some players like to make super-effective characters, or synergize really well with the other characters, and some don't make that a priority. So in the end you'll have to learn what your particular group needs. Experience budgets are just a tool for getting you closer, faster, than you might if you were figuring it out all on your own.