Convert String to Netstring
Wrap text in a netstring: byte length, colon, payload, comma.
What this page computes
Type or paste text and the page prints it as a netstring: the UTF-8 byte length, a colon, the text itself and a comma. The length is printed separately as a check, because it counts bytes rather than characters.
Where it stops
The page wraps one string, it does not split long text into chunks, and it does not escape anything, so a payload containing a comma is still a valid netstring by length but may confuse a reader. An empty box is refused because a page with no text has nothing to wrap.
Why the answer repeats
The encoding uses TextEncoder in this tab, so the same text always prints the same byte count and nothing is uploaded.
Wraps a string as a netstring — UTF-8 byte length, colon, payload, comma — and prints the byte count separately so it can be checked. One string only; an empty box is refused.
How to use it
Paste the text and press Run. The first line is the netstring and the second its byte length.
The arithmetic
TextEncoder gives the UTF-8 byte length, which is the number a netstring reader will consume. That is why an accented character counts as two bytes while it is one character on screen.
What to Expect
Best for
- Byte length, not character count
- Text printed between colon and comma
- Length repeated as a check
What this tool keeps
- the netstring and its byte length
Sample input
hello
Sample output
5:hello, Length = 5 UTF-8 byte(s)
Frequently asked questions
How do I use the string to netstring page?
Paste the text, then press Run. The first line is the netstring to copy.
Is anything uploaded?
No. The whole calculation runs in this tab with JavaScript: no request is made, no account is needed, nothing is stored, and the page keeps working offline once it has loaded.
What are its limits or bounds?
The box must hold at least one character. The length counts UTF-8 bytes, so a page whose text is empty has nothing to send and must be refused.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.