Rewrite Numbers
Given numbers and a grammar, recursively rewrite them. Runs entirely in your browser, so your data never leaves your device.
0 chars · 0 lines
Output
The result appears here as you type.
How to use Rewrite Numbers
- 1. Paste the starting digits. Enter the initial digit string in the input pane, for example a single 1 as the axiom of an L-system. This is the seed that every rewrite rule below gets applied to.
- 2. Define rewrite rules and iterations. In Rewrite rules, list one digit=replacement pair per line, such as 1=12 and 2=1. Set Iterations to how many times the rules should be applied in sequence, since each pass can grow the string a lot.
- 3. Watch the string grow. Every digit in the current string is looked up against your rules and replaced simultaneously, then the result becomes the input for the next iteration until the count is reached.
- 4. Copy the final sequence. Copy the resulting digit string from the output pane. Lower the iteration count first if you only want to inspect an early generation rather than the fully expanded sequence.
When to use Rewrite Numbers
Rewrite Numbers applies a Lindenmayer-style substitution grammar to a digit string, replacing each digit with a rule-defined sequence over repeated iterations. It is built for exploring how simple digit rules produce rapidly growing, self-similar sequences.
- Reproducing the rabbit sequence. The classic Fibonacci rabbit problem uses rules 1=12 and 2=1 starting from 1. Run three iterations here to get 12112 and confirm it matches what a textbook or paper describes.
- Prototyping an L-system before drawing it. You are building a turtle-graphics fractal and want to see the raw symbol string a rule set produces at each generation before wiring it up to an actual renderer.
- Exploring digit-substitution puzzles. A recreational math forum poses a rule like 0=01 and 1=0 and asks what the string looks like after ten steps. Enter the rule and iteration count to get the answer directly.
- Teaching recursive substitution. You are showing students how a small set of replacement rules can generate long, structured sequences from a single starting symbol, and want a live example they can tweak themselves.
Examples
Rabbit sequence rules (1=12, 2=1) for 3 iterations
Input
1
Output
12112
Digits without a rule stay unchanged
Input
102
Output
121120121
About the Rewrite Numbers tool
Rewrite Numbers runs as plain JavaScript in your browser tab, with no server behind it. Given numbers and a grammar, recursively rewrite them. Whatever you put in stays on your device from start to finish.
The tool is part of EditSafely's Number Tools section, 194 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.
You can shape the output with 2 settings, including Rewrite rules (one digit=replacement per line) and Iterations, and the result refreshes the moment you change one. 2 worked examples further down the page show exactly what the tool produces for real inputs.
That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.
Frequently asked questions
Does Rewrite Numbers cost anything?
Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.
Is it safe to paste sensitive or confidential data?
No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.
How much text can I process at once?
There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.
Do I need to sign up or install anything?
Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.
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.