I'm a beginning guitar player and I know most of the basic chords, but my bar chords just don't sound well. Either one string is buzzing or one of them is just deadened.
Can anybody give me some tips?
Without seeing what you're doing the only advice you're going to get is to practice more.
R.I.P. My Signature. Lost to us in the great Signature Massacre of 2014.

Quote by Master Foo
“A man who mistakes secrets for knowledge is like a man who, seeking light, hugs a candle so closely that he smothers it and burns his hand.”

Make sure u hold the barre all the way down with your index finger and the rest should be pressing strings down with your fingertips. If Ur using acoustic barre chords are harder to do and will clash more. Barre chords sound another on electric because of the distortion.
Press it down with the side of your index if you're barring the notes under your index finger and you still have ringing strings.
1. Remember that you only have to hold down the strings that are not being held down by other fingers.
2. A slight curve to the barre finger is often better than straight.
3. You shouldn't have to press like **** to hold it down
4. If your action is too high get it fixed
5. For A string barres, try to get in the habbit of using the end of you barre finger to damp the E string
6. For A string Major shape don't worry too much if you can't get the top E string to ring clean - but damp it instead of letting it rattle
7. Practice until it hurts but don't carry on when it is hurting
8. Watch loads of tutorial vids on barre chords - each teacher has a trick that might be for you.
9. Everyone has trouble going from a country chord to an F barre - it might take a year or two before you can do this - but if you practice it will come
10. Never Never give up.
All the previous tips are good. The most important thing you can do is to 'practice' the good technique described above but ALSO understand that progress doesn't happen overnight and you need to give your self 'permission' to sound less than perfect at your stage of acquiring skills. Play lots of songs that use barre chords as well as open chords and relax If you keep trying to hold your fretting hand in a good posture, it will start becoming more natural, 'feeling' right and then you can make the minute adjustments to get perfect sounds. Good luck!!
I emphasize # 4 from Simon's list..... A lot of beginners have a from-the-factory instrument which are often delivered with the action rather high; especially at the nut.
This can make that dreaded first-position "F" barre a real bear...

Have your action checked in addition to the other advice.