Building a Word Cloud in Razor with Business Impact in Mind

Building a Word Cloud in Razor with Business Impact in Mind

A word cloud isn’t just eye candy—it’s a meaningful way to visualize trends, user behavior, or content emphasis at a glance. Whether you're analyzing tags, keywords, or user-submitted content, a good word cloud can turn raw data into instant insight.

But implementing one yourself? Not so easy.

I wish someone had solved this for me back when I needed it most. So I did.
And now I’ve baked it into DevStack.

What This Razor Word Cloud Does

This dynamic word cloud is built entirely in Razor (server-side) and styled with inline CSS for maximum portability and compatibility.

  • Font scaling by frequency (logarithmic)
  • Randomized color, position, and rotation
  • Highlighting of top keywords
  • Hover animations for engagement
  • Lightweight—no external libraries required

Example output can be seen in action on this voting site:

👉 Top 10 Rock Bands


Key Razor Snippet

@foreach (var word in wordData)
{
    var fontSize = Math.Log(word.Value + 1) * 10;
    var color = isTopWord ? "#f00" : RandomColor();
    var left = Random.Next(5, 95);
    var top = Random.Next(5, 80);
    var rotate = Random.Next(-30, 30);

    <span class="word @(isTopWord ? "top-word" : "")"
          style="font-size:@fontSize}px;
                 color:@color;
                 left:@left%;
                 top:@top%;
                 transform: rotate(@rotate}deg);">
        @word.Key
    </span>
}

This renders each word with randomized positioning and styling. Top words (by frequency) get a special class for additional styling.


Why This Matters for Business

Anyone can show a list of keywords—but presenting data visually unlocks storytelling and engagement. I've used this feature to help clients:

  • Discover high-performing blog topics
  • Analyze community feedback
  • Visualize SEO keyword effectiveness
  • Enhance shareability with visual hooks

With 30+ years of business-savvy behind every line of code, tools like this aren’t just functional—they’re purposeful.


Ready to Use It?

If you’re a developer, DevStack gives you the code you need, fully integrated into a .NET Core solution.

If you’re a business owner, content creator, or agency, I can build this (and more) for your site. It’s already done. You don’t need to reinvent it.

👉 See my background

👉 See what I offer

👉 See why it works

👉 Check pricing


Want One for Your Site?

Let’s talk about how a visual tool like this could help tell your story or improve your user engagement.

here's the matching CSS:

.word {
    position: absolute;
    font-weight: bold;
    transition: transform 0.3s;
}
.word:hover {
    transform: scale(1.2);
}
.top-word {
    text-shadow: 1px 1px 2px #333;
}

You can drop this into a relatively positioned container for layout.


💻 Want to Use It?

You’ve got two great paths forward:

  • If you're a developer: Grab this ready-to-use code in DevStack
  • If you're a business or agency: I can implement this (and more) directly into your platform

It’s already built. You don’t need to reinvent it. Just use it.


Let’s build something engaging.

Request Access or Book a Demo

Or check my CV and Pricing if you're ready to move.