<includeonly>{{#if:{{{3|}}}|{{formatnum:{{#if:{{{2|}}}|{{{2}}}|{{#expr:{{{1|}}}*2.589988110336 round {{{4|1}}}}}}}}}&nbsp;{{#if:{{{5|}}}|{{#if:{{{6|}}}|[[{{{6}}}_m²|km²]]|[[Square kilometer|km²]]}}|km²}}&nbsp;({{formatnum:{{#if:{{{1|}}}|{{{1}}}|{{#expr:{{{2|}}} / 2.589988110336 round {{{4|1}}}}}}}}}&nbsp;{{#if:{{{5|}}}|[[Square mile|sq&nbsp;mi]]|sq&nbsp;mi}})|{{formatnum:{{#if:{{{1|}}}|{{{1}}}|{{#expr:{{{2|}}} / 2.589988110336 round {{{4|1}}}}}}}}}&nbsp;{{#if:{{{5|}}}|[[Square mile|sq&nbsp;mi]]|sq&nbsp;mi}}&nbsp;({{formatnum:{{#if:{{{2|}}}|{{{2}}}|{{#expr:{{{1|}}}*2.589988110336 round {{{4|1}}}}}}}}}&nbsp;{{#if:{{{5|}}}|{{#if:{{{6|}}}|[[{{{6}}}_m²|km²]]|[[Square kilometer|km²]]}}|km²}})}}</includeonly><noinclude>{{pp-template|small=yes}}

Usage: <nowiki>{{mi2km2|mi2|km2|switch|round|link|magn}}</nowiki>

Ordinarily produces: ''mi2'' sq mi (''km2'' km2).

If one of ''mi2'' and ''km2'' is omitted, it will be calculated by conversion of the other (which must be numerical or an error will be displayed).

Setting ''switch'' to any non-empty value causes the metric value to be displayed first.

Set ''round'' to define the degree of rounding (e.g. '''1''' for one decimal place).

Setting ''link'' to any non-empty value causes the units to be wikilinked to [[Square mile]] and [[Square kilometre]].

Setting ''mag'' changes the wikilink behind km2 (for example, set it to '''1 E06''' to link to [[1 E06 m²]]).

[[Category:Conversion templates|Mi2km2]]
</noinclude>