Home / CodesToolkit JavaScript library
CodesToolkit JavaScript library
Version 0.1.0, released December 3, 2026
A small JavaScript library with the same Morse, binary, hex, ASCII, Roman numeral, NATO alphabet, Caesar, ROT13 and braille converters that run the tools on this site. It has no other libraries to install, makes no network requests and keeps nothing in storage. MIT License.
Author: CodesToolkit. There is no named individual author. Bug reports are welcome on the contact page. The source is on Codeberg.
Download
| File | What it is | Size | SHA-256 |
|---|---|---|---|
| codestoolkit-0.1.0.zip | Zip of the library, tests, typings, licence and changelog | 24.0 KB | d69cdb3717404e3b9a42141ff6bfd662d5b86af76c8a731558d39809e76e15aa |
| codestoolkit.js | Single-file build for a script tag, or for require() in Node | 17.1 KB | a3da9cb355f7065ba7a5dd3dcf6e6bda9c5d968a3997e8962b669a9dc9c5691e |
| codestoolkit.mjs | Single-file ES module for import in a browser or in Node | 17.5 KB | b9194fbf8a073e693f2228a9bad44df6139cb1f8a8550e76b08bc3a7240b11b4 |
| codestoolkit.d.ts | TypeScript typings for the same functions | 2.5 KB | e9e82763e282d75fc3ff3eafb1bfb444b63db9d77172399545db6142c2889e50 |
| LICENSE.txt | MIT License | 1.0 KB | 2c53ea618744be8f01c449008d118c78fd8c9babafb0b43d94244cf06322d9ff |
| CHANGELOG.md | Changes in this and later versions | 413 bytes | 34a61542c9556a4b879c20808185eb9b4b5b7ae4804c2eeeb53415eb26983211 |
The zip unpacks to a folder named codestoolkit-0.1.0. The single-file builds are also in that folder, under src/, as index.js and index.mjs.
How to load it
In a web page, with a script tag
<script src="https://codestoolkit.com/library/codestoolkit.js"></script>
<script>
const result = CTK.morseEncode('SOS');
console.log(result.out); // ... --- ...
</script>In a web page, as an ES module
<script type="module">
import { morseEncode, textToBinary, numberToRoman } from 'https://codestoolkit.com/library/codestoolkit.mjs';
console.log(morseEncode('SOS').out);
console.log(textToBinary('Hi').out);
console.log(numberToRoman('2026').out);
</script>The .mjs file is sent with an Access-Control-Allow-Origin: * header, so a page on another site can import it directly. You can also download the file and host it yourself.
In Node.js
Download the zip or the single file, put it next to your script, and load it like this (Node 14 or later):
const ctk = require('./codestoolkit.js'); // or: import * as ctk from './codestoolkit.mjs'
console.log(ctk.morseEncode('SOS 2026').out);
console.log(ctk.hexToText('48 69').out);
console.log(ctk.caesar('Hello, World!', 3));What you get back
Every translator returns an object with three fields:
out: the converted text, or an empty string when there is an error.error:null, or a plain-English message such as a note that a hex string has an odd number of digits.notes: warnings, for example characters that had no code and were skipped. The input is never changed in silence.
caesar(text, shift), rot13(text) and allShifts(cipher) return ordinary values (a string, or pairs of shift and text) because those functions cannot fail.
Functions
| Area | Functions |
|---|---|
| Morse (International Morse, ITU-R M.1677-1 characters) | morseEncode, morseDecode, morseSchedule, morseUnits, unitMs, MORSE, morseOrder |
| Binary and numbers | textToBinary, binaryToText, decToBin, binToDec |
| Hex | textToHex(text, {sep, prefix, upper}), hexToText, decToHex, hexToDec |
| ASCII (codes 0 to 127; base 2, 8, 10 or 16) | textToAscii, asciiToText, asciiRow |
| Roman numerals (1 to 3999) | numberToRoman, romanToNumber, toRomanInt, romanPairs |
| NATO / ICAO spelling alphabet | natoEncode, natoDecode, NATO_LETTERS, NATO_DIGITS |
| Caesar and ROT13 | caesar, caesarEncode, caesarDecode, rot13, allShifts |
| Braille (uncontracted English, Unicode U+2800 block) | brailleEncode, brailleDecode, brailleCell, BRAILLE |
TypeScript typings ship with the files. Text conversions to binary and hex use UTF-8 bytes; the ASCII functions refuse characters above code 127 instead of guessing.
Limits you should know about
- Morse decoding treats
/,|, a newline or three or more spaces as a word gap. Only the international character set (letters, digits and a few punctuation marks) is included.morseSchedulegives dit and dash timing in units, andunitMs(wpm)converts units to milliseconds using the PARIS standard (1200 / wpm). - Braille is uncontracted (grade 1) letter-by-letter output with number and capital signs. It is not a substitute for professional braille transcription, and parentheses are unsupported because the cell is ambiguous.
- Roman numerals are standard subtractive form only, from 1 to 3999. Forms such as IIII or VX are rejected with an explanation.
- Caesar and ROT13 shift the letters A to Z and a to z only; everything else is left as it is.
- These are encodings and simple ciphers, not encryption. Do not use them to protect anything.
Tests
The zip includes a test suite. From the unpacked folder run:
node test/test_codes.js && node test/test_package.jsThat runs about 77,000 assertions: the International Morse table written out independently of the implementation, random round trips for every converter (with a fixed seed), every Roman numeral from 1 to 3999, every ASCII code in four bases, braille cases, a check that the CommonJS, ES module and TypeScript entry points agree, and a check that the library contains no network or storage calls.
Changelog
0.1.0 — 2026-12-03
First public release. The converters that run the tools at [codestoolkit.com](https://codestoolkit.com/), released as a small, zero-dependency JavaScript library: Morse code, binary, hexadecimal, ASCII, Roman numerals, the NATO phonetic alphabet, Caesar / ROT13 and uncontracted braille. MIT License. Hosted at [codestoolkit.com/library/](https://codestoolkit.com/library/).
Licence
MIT License. Copyright (c) 2026 CodesToolkit. The official text is in LICENSE.txt:
MIT License
Copyright (c) 2026 CodesToolkit
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
How this code was written
The converters were taken, unchanged, from the code that runs the tools on this site, together with their tests. Parts of the code and the explanatory text were drafted with AI assistance and then checked against the cited sources (ITU-R M.1677-1 for Morse, RFC 20 for ASCII, RFC 3629 for UTF-8, and Wikipedia for the other codes) and by the tests above. No individual author is named.