Convert a String to a Netstring
Wrap a string as a length-prefixed netstring. Runs entirely in your browser, so your data never leaves your device.
Runs on your device, nothing uploaded
0 chars · 0 lines
Output
Wrap a string as a length-prefixed netstring.
Type or paste above to see the result here.
What you paste never leaves this tab
Convert a String to a Netstring is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. On a normal site, the text you paste is sent to a server that can log it, cache it or keep it. Here it is read and transformed inside this tab and nowhere else.
- No upload
- No length limit
- Works offline once loaded
- Nothing stored or logged
How to use Convert a String to a Netstring
- 1. Paste the string to wrap. Enter the plain text you want framed as a netstring into the input pane, from a single word to a longer message.
- 2. Read the wrapped result. The tool measures the string's byte length and wraps it in the netstring format: the length, a colon, the string itself, and a trailing comma. Turn on Each line separately under More options to get one netstring per line.
- 3. Copy the netstring. Copy the resulting netstring and use it wherever length-prefixed framing is expected, such as a protocol that uses djb-style netstrings.
When to use Convert a String to a Netstring
Convert a String to a Netstring wraps a string as a length-prefixed netstring, the simple djb-designed format that avoids delimiter ambiguity by stating the exact byte length up front. It builds the exact framing a netstring-based protocol expects.
- Testing a netstring parser. You are writing a parser that reads netstring-framed messages and need a correctly formatted sample netstring to feed it as a unit test input.
- Hand-crafting a message for a djb-style tool. A tool like qmail or a related utility expects input framed as netstrings, and this produces the exact length-prefixed format from a plain message you type in.
- Teaching length-prefixed encoding. A networking or protocol design course wants a live example of how a plain string becomes a netstring, showing the length prefix computed from the actual byte count.
- Preparing a payload for a tnetstrings-based queue. You are working with a message queue that uses a netstring-derived format and need the base string correctly wrapped before adding type tags on top.
Examples
Length-prefix a word
Input
hello
Output
5:hello,
One netstring per line
Input
hello world
Output
5:hello,5:world,
About the Convert a String to a Netstring tool
Convert a String to a Netstring does its work locally, right in the browser. Wrap a string as a length-prefixed netstring. There is no upload step, no queue and no account, and your data never travels over the network.
It belongs to the String Tools collection on EditSafely, a set of 159 small, focused String utilities that share the same instant, private workspace.
You can shape the output with the Each line separately setting, and the result refreshes the moment you change it. 2 worked examples further down the page show exactly what the tool produces for real inputs.
Running locally also makes the tool fast and dependable: results appear as soon as your input does, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.
Frequently asked questions
Is Convert a String to a Netstring free to use?
Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.
Is it safe to paste sensitive or confidential data?
Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.
How much text can I process at once?
There is no fixed limit; your device's memory is the ceiling. Up to 10 MB the result updates as you type, after a short pause that grows with the size. Above 10 MB a Run button appears so typing stays smooth, and files open up to 50 MB. A very long result shows its first 2,000 lines on screen, while Copy and Download always include all of it.
Do I need to sign up or install anything?
No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.
How do I use the result?
The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.