Documentation

Get familiar with TxtFiddle.

What’s the general idea?

TxtFiddle is a script-driven text transformation tool. You provide some text in the “Input” editor, write JavaScript code to express how you want to transform the input, and return the result to the “Output” editor. That’s it.

How do I get started?

Let’s begin with a “Hello World” project:

  1. Go to https://txtfiddle.com/ and click the “New” button to create a blank fiddle.
  2. Enter Hello World into the “Input” editor.
  3. Enter return input; into the “Code” editor.
  4. Hit the “Run Code” button.

All the code does is return the content of the “Input” editor to the “Output” editor.

For more advanced fiddles that actually do something useful, select one of the example projects from the “New” menu.

If your JavaScript is a bit rusty, check out this JavaScript Cheatsheet for a quick refresher.

Do I need an account?

You can use TxtFiddle without creating an account, but you won’t be able to save and manage your fiddles.

Can I share my fiddle with others?

Once you hit the “Save” button, your fiddle’s content is uploaded to our servers and made available under a unique URL. You can pass this URL to others who can access the fiddle, run the code, or save variations of it to their own account. Only you, however, will be able to update or delete the fiddle.

Please note that saved fiddles are always publicly accessible. Anyone who knows or guesses the URL can access the content. Be careful to remove any sensitive or exposing data from the fiddle before publishing it!

How large can the input and output be?

We recommend keeping both input and output under 200 megabytes. You may run into performance and memory issues when trying to work with content larger than that.

If you want to save your fiddle, you need to keep your input and code under 2 megabytes each.

Can I load a text file from my computer?

Yes, you can drag and drop a file from your computer onto the “Input” editor or use the editor’s “Load text from…” context menu item to import a file.

In a similar fashion, it’s possible to export text by selecting “Save text as…” from the context menu.

Which version of JavaScript is supported?

The JavaScript code you write is executed by a web worker in your browser (and not run on our servers). This means you can use whatever JavaScript features your browser supports.

Running the code inside a worker comes with a few limitations compared to “normal” scripts that run on the browser’s main thread, such as not having access to the window object or to DOM-related functions.

Code completion and error highlighting in the editor is provided for ECMAScript 2020 (ES2020).

Is it possible to import external libraries?

You can use the importScripts() method to synchronously import an external script:

importScripts("https://cdnjs.cloudflare.com/ajax/libs/timeago.js/4.0.2/timeago.min.js");
return timeago.format("2021-03-15");

Which keyboard shortcuts are supported?

These two shortcuts will likely save you the most time:

Ctrl/Cmd + Enter Run code
Ctrl/Cmd + S Save fiddle

When working with the code editor, the following shortcuts will come in handy:

F2 Rename symbol
Shift + Option/Alt + F Format entire JavaScript code
Shift + Option/Alt + A Toggle block comment
Ctrl/Cmd + X Cut entire line
Alt/Option + Up Arrow Move line up
Alt/Option + Down Arrow Move line down
Ctrl/Cmd + F Find
Ctrl/Cmd + H Replace

I didn’t find the answer to my question, what can I do?

Please use the contact form to get in touch and we’ll be glad to help!