The W-2 form is not used to claim dependents; it is intended for an employer to report its employee's income tax withholdings and annual earnings. According to the IRS, the W-4 form is the correct form for claiming dependents.
According to Kiplinger, a worksheet specific to personal allowances is provided with the W-4 form. This worksheet can then be used to calculate personal allowances, such as dependents. More specifically, line D on the W-4 form under the "Personal Allowances Worksheet" header is the section used for entering the number of dependents that are to be claimed on a tax return.