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 have | You want | Start here |
|---|---|---|
| An identifier or label | Readable text or another identifier convention | Strings and casing |
| A noun and count | Correct singular/plural quantity text | Inflection and quantities |
| A date, time, or duration | Relative, elapsed, fluent, or spoken output | Date and time scenarios |
| A number or number phrase | Words, ordinals, parsing, metric, or Roman output | Number and data scenarios |
| An enum or sequence | A readable label or localized list | Enum and collection scenarios |
| A culture-specific rule | Explicit culture or custom behavior | Localization 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.
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. 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 this 2.x release 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.