ScriptsJul 21, 2026·3 min read

Humanizer — String, Date & Number Manipulation for .NET

Humanizer transforms .NET strings, enums, dates, times, timespans, numbers, and quantities into human-friendly representations, with full localization support for dozens of languages.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Humanizer
Direct install command
npx -y tokrepo@latest install 26cd05cf-8500-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

Humanizer is a .NET library that turns machine-oriented data into human-readable text. Whether you need to display relative timestamps, pluralize nouns, truncate strings, or convert enums to friendly labels, Humanizer provides a consistent fluent API that keeps your UI code clean and your output natural.

What Humanizer Does

  • Converts PascalCase, camelCase, underscore_case, and kebab-case strings to sentence or title case
  • Displays relative dates and times (e.g., "2 days ago", "in 3 months")
  • Pluralizes and singularizes English nouns with override support
  • Converts numbers to ordinal strings, words, and Roman numerals
  • Truncates strings with configurable strategies (fixed length, word boundary, character)

Architecture Overview

Humanizer is a pure .NET library distributed as a single NuGet package. It targets .NET Standard 2.0 and above, which means it runs on .NET Framework 4.7+, .NET Core, .NET 5-9, Xamarin, and Unity. Localization resources for 40+ languages are bundled as satellite assemblies, and the fluent extension-method API means zero configuration for most use cases.

Self-Hosting & Configuration

  • Install via NuGet: dotnet add package Humanizer
  • No external dependencies or services required
  • Localization is automatic based on Thread.CurrentThread.CurrentUICulture
  • Override pluralization rules by registering custom vocabularies
  • Extend with your own IStringTransformer or ITruncator implementations

Key Features

  • Fluent extension methods on string, DateTime, TimeSpan, int, and enum
  • 40+ localized language packs for date and number humanization
  • Multiple truncation strategies: fixed length, word, character
  • ByteSize helper for human-readable file sizes (e.g., "1.2 GB")
  • Metric prefix support for scientific and engineering notation

Comparison with Similar Tools

  • String.Format / interpolation — built-in but no relative dates, pluralization, or casing transforms
  • NodaTime — advanced date/time modeling but no humanization layer
  • Pluralize.NET — pluralization only; Humanizer covers strings, dates, numbers too
  • FluentDateTime — date arithmetic helpers; does not humanize output
  • SmartFormat.NET — template-based formatting; Humanizer is more extension-method driven

FAQ

Q: Does Humanizer support my language? A: Humanizer ships with localized resources for 40+ languages including Spanish, French, German, Chinese, Japanese, Arabic, and many more.

Q: Can I use Humanizer in Blazor or MAUI apps? A: Yes. Humanizer targets .NET Standard 2.0, so it works in Blazor, MAUI, WPF, WinForms, and any .NET runtime.

Q: How do I add custom pluralization rules? A: Call Vocabularies.Default.AddIrregular("person", "people") or AddUncountable("fish") at startup.

Q: Is Humanizer thread-safe? A: Yes. All extension methods are pure functions. Culture is read from the current thread at call time.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets