What is the difference between Html.Partial, Html.RenderPartial and the partial tag helper?

ASP.NET MVC Views & Razor Intermediate 2–3 Yrs3–5 Yrs Conceptual 1 min read

Quick Answer

@Html.Partial(...) returns the rendered HTML as a string (which Razor then writes). @{ Html.RenderPartial(...); } writes directly to the response stream — slightly more efficient, but must be in a code block. The modern <partial name="_X" /> tag helper (and PartialAsync) is the recommended approach and is async-friendly.

They render the same thing but differ mechanically. Html.Partial builds a string and returns it for Razor to output; Html.RenderPartial writes straight to the response stream, which is marginally faster but has to go in a code block. Both of those are the old way. Now I use the <partial> tag helper, which is cleaner to read, handles the model nicely, and is async-safe — the synchronous Html.Partial can actually deadlock if the partial does async work.

  • Prefer <partial name="_ProductRow" model="item" /> — readable, async, and passes the model cleanly.
  • The synchronous Html.Partial can deadlock if the partial does async work; use Html.PartialAsync or the tag helper.
  • RenderPartial's stream-writing advantage is negligible in most apps.