Blazor is a modern framework from Microsoft that allows creating interactive web applications in C# and .NET, without using JavaScript. When you build an application in Blazor, you will face a choice between two hosting models for components: Blazor Server or Blazor WebAssembly (WASM). Each has its own unique features, advantages, and limitations. In this article I briefly explain the differences between Blazor Server and Blazor WebAssembly, and suggest which variant might better suit your project.
Blazor Server — application on the server
Blazor Server runs the application completely on the server side. The user interface is rendered on the server within an ASP.NET Core app, and only the UI diffs (so-called “diffs”) are sent to the client’s browser through a persistent real-time connection (SignalR). The client browser acts as a thin client — it receives a minimal HTML/JS bootstrap, establishes a WebSocket connection with the server, and applies DOM updates sent from the server. As a result, most of the work is done on the server, and the client only displays the results.
Advantages of Blazor Server
- Very small initial load size and fast startup — only a lightweight bootstrap file is sent to the browser, instead of the full .NET runtime.
- Immediate responsiveness — since you don’t need to download large packages initially.
- Logic runs on the .NET server — giving full access to .NET APIs and server resources (e.g. database, file system) directly from Blazor code.
- Better security for code and data — all .NET/C# code remains on the server, so sensitive portions (like API keys or secret algorithms) are not exposed to the browser.
- Works on older or limited clients — supports browsers without WebAssembly, weak devices, because the client doesn't have to perform heavy computations.
Limitations of Blazor Server
- The application requires a constant network connection — if lost, the interface becomes non-functional (no offline mode).
- Every user interaction triggers a round trip to the server, introducing latency dependent on network quality. Highly dynamic interfaces (e.g. real-time mouse tracking) may feel less smooth in this model.
- Scalability challenges — the server maintains a separate “circuit” (state) for each connected client, so memory and CPU usage grow with the number of users. Large scale may require optimizing infrastructure (server farms, Azure SignalR Service, etc.).
- Requires an ASP.NET Core backend — cannot be hosted as static content. The model cannot be run purely on a static file host or CDN.
Blazor WebAssembly — application in the browser
Blazor WebAssembly runs the application on the client side, in the user’s browser using WebAssembly. On startup, the browser downloads all necessary code: compiled .NET assemblies, dependencies, and a small .NET runtime (dotnet.wasm). Once loaded, the Blazor application runs entirely in the browser — UI rendering and event handling occur locally (on the UI thread in JS/WASM), without constant trips to the server. The server (if used) then acts only as a data provider or file server — it does not participate in real-time UI rendering.
Advantages of Blazor WebAssembly
- After the initial download, the application can run independently — even offline — making Blazor WASM suitable for PWA (Progressive Web App) scenarios.
- Server load is reduced — most processing is offloaded to the user's device, limiting server-side resource demands.
- Simpler and cheaper hosting options — the app can be deployed as pure static files (HTML/CSS/JS) on a static host or CDN without needing a .NET server.
- UI interactions are fast and local — logic executes client-side, so user actions do not suffer from network latency.
Limitations of Blazor WebAssembly
- Bigger download size and slower startup — the browser must fetch the .NET runtime and many assemblies before the app can begin.
- Client-side code is visible — experienced users may decompile DLLs and see business logic, strings, etc. Sensitive secrets or heavy logic should not be placed in client-side code.
- Browser sandbox constraints — the application runs in the browser sandbox, so you cannot directly access file system, registry, or local database. Any such operations must go via web APIs (HTTP/gRPC).
- Requires modern browser support — WebAssembly must be supported; legacy browsers like Internet Explorer 11 are not supported.
For example, in Blazor Server your application can directly access the database via Entity Framework in a component, e.g.:
@inject MyDbContext _dbContext;
<button @onclick="SaveData">Save</button>
@code {
void SaveData()
{
var user = new User { Name = "Jan" };
_dbContext.Users.Add(user);
_dbContext.SaveChanges();
}
}
In Blazor WebAssembly, this direct database access is not possible in the browser. Instead, you typically call a backend API via `HttpClient`, e.g.:
@inject HttpClient _http;
<button @onclick="() => SaveDataAsync(new User { Name = " jan"="" })"="">Save</button>
@code {
public record User { public string Name { get; set; } }
async Task SaveDataAsync(User newUser)
{
await _http.PostAsJsonAsync("https://my-server/api/users", newUser);
}
}
Here `PostAsJsonAsync` sends the `User` object to a server API, which performs the actual database operation. This division into client (WASM) and server (API) adds complexity but is standard in SPA browser apps.
When to Choose Blazor Server vs WebAssembly?
Both Blazor variants aim to help you build rich interactive web apps in C#, and they can share Razor component code. The decision depends on project specifics.
- Choose Blazor WebAssembly when offline or PWA support is required (app should run without constant server connection). Also useful when you want to offload processing to the client and simplify server infrastructure. Great for apps used on multiple devices that leverage browser features (camera, local storage) and for simple deployment via static hosting.
- Choose Blazor Server when data security and server logic integration are priorities. Logic and secrets stay on the server, simplifying protection and architecture. Suitable when you need tight coupling with backend services, direct database access, or fast startup on varied client environments (including legacy browsers).
- Note: With .NET 8 and onward, hybrid approaches like Blazor United allow blending server-side rendering with WebAssembly capabilities in one application. You can also port between models, since Razor components are shareable — though architectural adjustments are needed.
Summary
Blazor Server and Blazor WebAssembly represent two different paths to build Blazor applications, each with advantages in particular scenarios. If you need full .NET power server-side, fast initial rendering, and are not concerned with offline modes — Blazor Server might be the better option. On the other hand, if you value client-side operation, offline capability, and lighter server burden — Blazor WebAssembly may be more suitable. The ultimate choice should be based on your project’s requirements, infrastructure context, and user expectations.
If you want to explore Blazor in practice (Server and WASM), check out my online training Blazor School, where we build real apps step by step in both models and discuss their use. It might help you decide confidently on the right model for your next project. Good luck building your app.