How to get part of a text online
Copyable sample text
Start index and End index explained
Get the first N characters of a text
Copy the result or download it as a .txt file
Features explained
Slice text by start and end index
Returns the part of your text between the Start index and the End index.
Start index option
Sets where the piece begins. The default is 0, the beginning of the text.
End index option
Sets where the piece stops. The default is 10, so by default you get the first 10 characters.
Copy result to clipboard
One click copies the result. The button changes to Copied! so you know it worked.
Download as .txt
Saves the result as a plain text file, useful when you want to keep it.
Load example
Fills the input with sample text so you can see how the Start and End index work before using your own.
Clear and reset
The Clear button empties the tool so you can start with new text.
Runs in the page
Text is processed with JavaScript in the page. No request to a server was found in the tool code.
What can you use it for?
Get the first characters of a string
Take the first 3, 5 or 100 characters of a code, name or sentence by setting the End index.
Make a short preview
Cut a long line down to a short piece for a title, a snippet or a note.
Take a part from the middle of a string
Set a Start index and an End index to pull out a piece from inside a longer text, such as part of an ID or a reference number.
Test substring and slice logic
Check what a slice with a given start and end should return before you use it in your own code.
Teach how indexes work
Show students how start and end positions pick a piece out of a text.
Tool information
| Tool type | Text slicer (substring by start and end index) |
|---|---|
| Input | Plain text, pasted or typed in the Input text box |
| Start index (default) | 0 |
| End index (default) | 10 |
| Output | The selected part of the text in the Result box |
| Copy | Copy result button |
| Download format | .txt (plain text) |
| Processing | In the page with JavaScript (client-side) |
Benefits
- No need to count characters by hand and delete the rest.
- Two simple options give you full control over which part you keep.
- The defaults give you the first 10 characters right away.
- Copy or download the result in one click.
- Works in the browser page, with nothing to install.
Limitations
- It works with plain text. The code shows no file upload, so paste your text into the box.
- It has two options only: Start index and End index. It does not search for words or cut at a pattern.
- It returns one piece of the text. It does not split the text into many parts.
- Check the result if your text has emoji or other special characters.
- The download is a .txt file only.
Privacy
This tool processes your text in the page using JavaScript, and no network request was found in the tool code. Even so, do not paste confidential information such as passwords or private data.
Tips
- Use Load example first to see how the Start and End index change the result.
- Start at 0 when you want the beginning of the text.
- If the result is not what you expect, change the End index a little and look again.
- Press Clear before you paste new text so old text does not stay in the tool.
Frequently asked questions
How do I get part of a text online?
Paste your text into the Input text box, then set the Start index and the End index. The part between them appears in the Result box.
How do I get the first 10 characters of a text?
Leave the default settings: Start index 0 and End index 10. Paste your text and the result shows the first 10 characters.
How do I get the first N characters of a string?
Keep the Start index at 0 and set the End index to N, the number of characters you want.
What are the Start index and End index?
They are the positions in your text where the piece begins and stops. The Start index is 0 and the End index is 10 by default.
Can I take a part from the middle of a text?
Yes. Set a Start index above 0 and an End index after it, and the tool returns the piece between them.
Can I copy or download the sliced text?
Yes. Press Copy result to copy it, or Download .txt to save it as a plain text file.
Is my text uploaded to a server?
The tool processes text in the page with JavaScript, and no network request was found in the tool code. Still, avoid pasting confidential information.
Can this tool split a text into many parts?
No. It returns one piece of the text, the part between the Start index and the End index.