为 indicates that someone does something for someone or something else. 为 is placed after a subject and before an object.
who for? what for?
I'll pay for you
wǒ wèi nǐ fùqián
They had wine for adults and soft drinks for children
tāmen wéi chéngnián rén zhǔnbèi le jiǔ, wèi háizimen zhǔnbèi le qìshuǐ
This warrior gave his life for his country
zhè wèi yǒngshì wéi zǔguó xiànchū le shēngmìng
The meaning of 为 is similar to the meaning of 给 , but 给 is more informal than 为.
为 is most often used when referring to obligations or duties. For example, 为 is used when you want to say that a person works for a company.
给 indicates that a matter is voluntary or a person wants to do a favour.
We mostly use 为 in formal speech.
He works for the Ministry of Health
tā wéi wèishēngbù gōngzuò
I'd be happy to work for you
wǒ hěn lèyì wèi nǐ gōngzuò
为 also means "because of", "for the purpose of".
I'm worried about this
wǒ wèi zhè shì dānxīn
He was disappointed by the breakdown of his marriage
tā wéi hūnyīn pòliè ér jǔsàng
The preposition 为了
The preposition 为了 describes the purpose of an action.
It can be followed by words denoting a person or an inanimate object. For example: for your sake, for money.
It can also be followed by words denoting an abstract concept or an action. For example: for your safety, in order to buy a house.
for what? for what?
He sold his watch in order to get some money
wèile qián, tā mài le zìjǐ de shǒubiǎo
The door is always closed for safety reasons
wèile ānquán, mén zǒngshì guānzhe de
We can state the subject either at the beginning or in the middle of the sentence.
If we state the subject in the middle of a sentence, as in the examples above, we should put a comma before it.
If the subject is stated at the beginning of the sentence, we should put the conjunctions 而 or 才 between the target and the action.
She believes life is all about having fun
tā wèile wán ér huózhe
My connecting flight is in Beijing
wǒ wèile zhuǎnjī cái zài běijīng tíngliú
We also can state the target at the end of the sentence. In this case we should use the verb 是 before 为了.
With both 为了 and为, we can state a person as the target. In this case they have the same meaning “for someone's sake”.
I did it for you
wǒ zhème zuò shì wèile nǐ
I did this all for you
wǒ suǒ zuò de yīqiè dōu shì wèile nǐ
In such sentences, the focus shifts to the target itself.