Prøve i Dansk 2 and 3: which one do you need?
The two Danish exams appear in both the permanent-residence rules and the citizenship rules, at different levels. Here is which is required where.
Also available in Dansk
For permanent residence
The minimum is Prøve i Dansk 2. If you pass Prøve i Dansk 3 instead, it satisfies the language condition and one of the four supplementary conditions. It counts twice, which is worth considering if you are close to the level.
For Danish citizenship
The general rule is Prøve i Dansk 3. But if you meet the self-support condition and have received public assistance for no more than 3 months in the last 9 years, Prøve i Dansk 2 is enough.
Exceptions
If you completed compulsory school in Swedish or Norwegian, a passed leaving exam from there can stand in for the Danish documentation. It is the schooling that counts — speaking the language is not enough.
If you live in Greenland or the Faroe Islands, your Danish is assessed in conversation rather than by exam. Children under 12 do not have to document Danish at all.
Where there is a long-term physical, psychological, sensory or intellectual impairment, the case can be put to the Parliamentary Naturalisation Committee for a dispensation. Being put to the committee is not the same as being granted one.
Check your own situation
The language requirement is only one of many conditions, and which one applies depends on your route. Run the checker and you will get the conditions that actually apply in your case.
Sources
Circular no. 9461 of 17 June 2021 section 24 and annexes 3.a and 3.b; the Aliens Act section 11(3)(7) and 11(4)(4).