Skip to main content
Version: 3.0.1

Find a Humanizer scenario

Orientation​

Start with the value you already have and the text you need to produce. Humanizer keeps dates, durations, numbers, byte sizes, enums, and collections as typed values until the display boundary; each guide below shows the operation, deterministic culture or clock setup, failure behavior, and the versions where the API exists.

You haveYou wantStart here
An identifier or labelReadable text or another identifier conventionStrings and casing
A noun and countCorrect singular/plural quantity textInflection and quantities
A date, time, or durationRelative, elapsed, fluent, or spoken outputDate and time scenarios
A number or number phraseWords, ordinals, parsing, metric, or Roman outputNumber and data scenarios
An enum or sequenceA readable label or localized listEnum and collection scenarios
A culture-specific ruleExplicit culture or custom behaviorLocalization and extensibility

Example​

Every substantive scenario imports source compiled and run against the selected package. This smallest example demonstrates the shared rule: set culture explicitly, call Humanizer at the presentation boundary, and assert the result.

Program.cs
using System.Globalization;
using Humanizer;

CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");

var result = TimeSpan.FromMinutes(2).Humanize();
if (result != "2 minutes")
throw new InvalidOperationException($"Unexpected result: {result}");

Console.WriteLine(result);

Less common tasks​

Pitfall​

Humanized output is presentation text, not a stable storage or wire format. Keep the original typed value and regenerate text for the active culture. A parser such as TryToNumber or ByteSize.TryParse has an explicit input contract; it does not make arbitrary humanized output round-trip safe.

Version notes​

The site covers selected releases from 2.10.1 through 3.0.10 plus main/preview. Use the version selector before copying a call. Focused pages state important API boundaries, and unavailable pages are removed or replaced in historical snapshots.