Skip to content

Blazor: interactive web UI with C# and .NET

Blazor is the ASP.NET Core framework for building interactive web user interfaces with C# and Razor instead of a JavaScript front-end framework. You write components that combine HTML markup with C# logic; Blazor renders them on the server as HTML, keeps them interactive over a real-time connection, or runs them in the browser on a WebAssembly build of .NET. The same components can also run inside native desktop and mobile apps through Blazor Hybrid.

A Blazor app is a tree of Razor components (.razor files). Each component holds markup, C# fields and methods, parameters for data passed in, and event callbacks for data passed out, much like components in React or Vue. Blazor tracks the rendered output, works out the differences after each event and updates only what changed in the browser.

Since .NET 8, the recommended project type is the Blazor Web App, in which each component chooses a render mode: static server rendering for fast HTML pages, Interactive Server for UI that runs on the server over SignalR, Interactive WebAssembly for UI that runs in the browser, or Interactive Auto, which starts on the server and moves to WebAssembly on later visits.

  • One language and toolchain. C#, .NET libraries, dependency injection, NuGet, Visual Studio and the .NET debugger across front end and back end.
  • Shared code. Validation attributes, models and business rules can be shared between the API and the UI.
  • Flexible hosting. Server, WebAssembly and native hosting from the same components, chosen per component.
  • Interop when needed. JavaScript libraries remain available through JavaScript interop.

WebAssembly components add a first-visit download of the .NET runtime, and Interactive Server components need a stable, low-latency connection and server memory per open browser tab. The ecosystem of third-party UI components is smaller than Reactโ€™s, and many front-end specialists know JavaScript frameworks better than Razor.

As of November 2026, two .NET releases are supported:

Release Support Ends
.NET 11 (STS) Released November 2026 November 2028
.NET 10 (LTS) Released November 2025 November 2028

Both receive monthly servicing updates; .NET 10 is the safer default for apps that upgrade slowly, and .NET 11 adds Blazor features such as client-side validation for static SSR forms, asynchronous form validation, the CacheView component and server-initiated circuit pause. Create a project with dotnet new blazor and choose the interactivity with --interactivity None|Server|WebAssembly|Auto. The samples in this section were compiled with the .NET 10 SDK.

Step Page What you get from it
1 Razor components Component syntax, parameters and EventCallback, data binding and EditForm validation, and the lifecycle methods for loading data.
2 Hosting models and render modes Static SSR, Interactive Server, Interactive WebAssembly, Interactive Auto and Blazor Hybrid, with a comparison table for choosing.
Concept Where it is covered
@code, @page, @inject, Razor syntax Razor component basics
[Parameter], EventCallback, @key Parameters and event callbacks
@bind, EditForm, data annotations Data binding and forms
OnInitializedAsync, OnParametersSetAsync, disposal Component lifecycle
@rendermode, prerendering, RendererInfo Blazor Web Apps and render modes
Streaming rendering and enhanced navigation Static server rendering
Circuits and SignalR Interactive Server
Running in the browser Interactive WebAssembly and Interactive Auto
Native apps Blazor Hybrid
  • The C# language features used in components: C# null handling and the rest of the C# section.
  • Compare the component model with React and Vue.