Integer to String
Format a number as text (with zero-padding)
- STRING
The reason most people land on this node: they want a number in a filename, and they want it to look like 0042, not 42. JWIntegerToString turns an INT into a STRING, and the format string it gives you is where the zero-padding lives. That padding is the whole appeal - it's what makes frame_1, frame_2, … frame_10 sort correctly as frame_0001, frame_0002, … frame_0010 in a file browser or a video encoder.
You'll reach for it any time a number needs to become text: building a save path, labelling an output, gluing a counter into a string with a concat node. On its own an integer can't plug into a string socket - this node is the adapter, and it lets you control exactly how the number reads.
How it works
It takes your integer and runs it through a Python format string, then outputs the result as text. The default {:04d} means "this integer, at least 4 digits wide, zero-padded on the left." So 42 → "0042", 7 → "0007", 12345 → "12345" (it doesn't truncate - the width is a minimum, not a maximum).
A few format strings worth knowing:
{:04d}- zero-pad to 4 digits (the default). Use{:06d}for 6, and so on.{:d}- plain, no padding (42→"42").{: d}or a prefix in the string - you can wrap extra characters around it, e.g.frame_{:04d}→"frame_0042".
If you know Python's format spec, it all works the way you'd expect.
The inputs and outputs that matter
value(INT) - the number to convert. Default0.format_string(STRING) - the format, default{:04d}. This is the knob that matters; change the digit count to change the padding width.- Output:
STRING- the formatted text.
How to install it
Part of jamesWalker55/comfyui-various, a pack of small utility nodes.
- ComfyUI Manager: search "Various ComfyUI Nodes by Type", install, restart. Red node in a downloaded workflow? Install Missing Custom Nodes.
- Manually:
Restart afterward. No models, no dependencies.cd ComfyUI/custom_nodes git clone https://github.com/jamesWalker55/comfyui-various
Under the jamesWalker55 category after restart.
Common issues
- The format string throws an error. The
{...}has to be a valid Python format spec.{:04d}is fine; something like{:04}without thed, or a stray brace, can error or produce odd output. When in doubt, start from the default and only change the number. - I put a float in and it broke. This node expects an integer - the
din{:04d}is the integer format code. For decimals use JWFloatToString with a float-style format like{:.2f}. - My padding vanished. If your number is already wider than the pad width (say
12345with{:04d}), you get all five digits - padding only adds leading zeros, it never trims. Widen the spec if you need more. - Node is red / missing. The pack isn't installed. Install via Manager or clone the repo, then restart.
Pair it with JWStringConcat to build things like "render_" + "0042" + ".png", and you've got clean, sortable output names without a scripting node in sight.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT | 0-18446744073709550000–18446744073709550000 | — |
| format_string | STRING | {:04d} | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |