Slice Text

Pull any run of characters out of your text by position - from the whole text at once or from every line separately.

Online Slice Text

This tool extracts a slice of characters from your text by start and end position, from the whole text or from every line.
Type or paste your text below, set the start and end positions, and the sliced result appears in the "Output" field.


Load an example

0 characters
0 characters
Settings
First character to take (1-based). Negative counts from the end. Blank = start of text.
Last character to take, included. Negative counts from the end. Blank = end of text.

Slice every line separately, one result per line. Untick to slice the whole text once.
Print each slice's characters backwards.
Drop lines whose slice is empty instead of keeping blank lines.
Ready to slice your text.


Overview

What it is: The Slice Text is a free online utility that extracts a run of characters - a "slice" - out of your text by character position. Instead of selecting text with the mouse and hoping you grabbed the right spot, you name the exact range - a start position and an end position - and the tool hands back precisely those characters, nothing more and nothing less.

What it does: Feed it any text - a single word, a long line, or a list with hundreds of rows. The tool counts characters from the beginning with positive positions (1-based, end position included) or backwards from the end with negative ones, then copies everything in between into the output box. It can slice the whole text once, or apply the same positions to every line separately, print each slice backwards, and skip lines too short to produce a slice. The output updates live as you type, and character counters under both fields show the exact lengths at all times.

Why it is useful: A surprising amount of everyday text work is just grabbing a piece of a string: the numeric code inside a product label, the file name after a fixed date prefix, the last four digits of an order number, or one phrase out of a stored paragraph. Doing that by hand invites off-by-one mistakes, and writing a one-off script for it wastes time. This tool makes the cut precise, repeatable and instant - and your original text stays untouched in the input box.

What it is built with: It is written in plain JavaScript and runs entirely in your web browser. Your text never leaves your device, there is no account to create and nothing is stored anywhere, which makes it just as safe for confidential lines like order numbers or internal file names as for throwaway test data.


How to Use This Tool

1. Enter your text: Paste or type the text you want to cut from into the "Text to slice" box, click "Upload a file" to load a text file, or click "Load an example" to try a sample. It can be a single word, one long line, or a list with hundreds of lines.

2. Set the positions: In the "Settings" box below the text areas, fill in Start position and End position. Positions are 1-based and the end position is included, so 2 and 4 take three characters starting at the second one. Leave Start position blank to begin at the first character, leave End position blank to run through to the last, and use negative numbers to count from the end (-1 is the last character).

3. Choose the options: Keep Slice each line ticked to apply the positions to every line independently, or untick it to treat the whole text as one string. Tick Reverse slices to print each slice backwards, and Skip empty slices to drop lines that are too short to produce a slice.

4. Generate the output: With Live mode switched on above the text areas (the default), the "Output" box updates as you type and change settings. Turn it off to update the output only when you press the Slice Text button.

5. Use the result: Copy and Download sit at the foot of the output box, ready for pasting or saving the result, and Clear & Reset clears everything back to the start. Character counters under both fields show the exact length of your text at all times.


Examples

Every example below loads its own text and settings - click "Try it" and the tool does the rest.

1. Extract a product code

Positions 5 to 9 of the product label land exactly on the numeric code, so the slice returns the five digits without the "SKU-" prefix or the colour name.

Input
SKU-88413-Blue
Output
88413

2. Strip a date prefix from file names

With "Slice each line" ticked and a start position of 12, every exported file name is sliced past its fixed-width date prefix in a single pass.

Input
2026-03-14 sales.csv
2026-03-15 inventory.csv
2026-03-16 orders.csv
Output
sales.csv
inventory.csv
orders.csv

3. Count positions from the end

A start position of -4 counts four characters back from the end of the line, so the last four digits of the order number come out without knowing the full length.

Input
Order #582014
Output
2014

4. Make backwards words

With "Slice each line" and "Reverse slices" on and an end position of 3, every three-letter word in the list comes back spelled backwards.

Input
cat
dog
owl
rat
Output
tac
god
lwo
tar

5. Slice the whole text at once

With "Slice each line" unticked, the whole paragraph is treated as one string, and positions 15 to 26 lift the middle sentence straight out.

Input
Coffee first. Code second. Sleep later.
Output
Code second.

Features

Start and end positions: Any whole numbers, 1-based, with the end position included. In Bandwidth, a start of 1 and an end of 4 returns Band. Blank fields mean "from the first character" and "through to the last".

Negative positions: Count from the end of the text, so a start of -3 on Parallel returns the last three characters, lel, and -5 to -3 on Backflip returns kfl.

Slice each line: Ticked (the default), every line is sliced independently and the results come back one per line. Unticked, the whole text - line breaks included - is treated as a single string and sliced once.

Reverse slices: Prints each slice's characters in reverse order, turning Night into thgiN when the slice covers the whole word.

Skip empty slices: With line slicing on, lines shorter than the start position would normally come out as blank lines. This option drops them, so slicing a mixed list from position 6 keeps only the long lines.

Live mode: On by default, the output refreshes as you type or change a setting, so you always see the result without pressing anything. Switch it off and the output stays put until you click Slice Text.

Instant counts: Both character counters update as you work, so you always know the exact length of the result - input or output - before you copy it.

Load an example / Upload a file / Copy / Download: "Load an example" fills the input box so you can try the tool instantly. "Upload a file" reads a .txt or .rtf file. "Copy" and "Download" sit at the foot of the output box; "Clear & Reset" clears the tool back to its start.


When to Use This Tool

Strip a fixed-width date, account or batch prefix from every line of an exported report or a file-name list in one pass.

Pull product codes, ISBNs or order numbers out of longer inventory labels without retyping a single digit.

Lift a substring from every log line or every row of a fixed-width report - no script or spreadsheet formula required.

Reverse short slices to build word games, spelling drills and classroom puzzles from any word list.

Pull a single phrase back out of a stored paragraph or template by its exact position.


FAQs

FAQ 1: How are the positions counted?
Answer: Positions are 1-based and the end position is included, so a start of 2 and an end of 4 on Sliced returns lic. Leaving the start blank begins at the first character, and leaving the end blank runs through to the last.

FAQ 2: Can I count from the end of the text?
Answer: Yes. Negative positions count backwards, with -1 being the last character. A start of -3 alone takes the final three characters, and a range such as -5 to -3 takes the fifth-to-last through the third-to-last characters.

FAQ 3: What exactly does "Skip empty slices" do?
Answer: It only applies when "Slice each line" is ticked. A line shorter than the start position produces an empty slice; with this option off that line stays in the output as a blank line, and with it on the line is dropped so the output holds only real results.

FAQ 4: What happens if the start position is greater than the end position?
Answer: Every slice comes out empty and a note appears under the output explaining the problem. Swap or adjust the two positions and slice again.

FAQ 5: How does the tool handle multi-line text?
Answer: By default each line is sliced on its own and the results are returned one per line. Untick "Slice each line" to treat the entire input, line breaks included, as one string and extract a single slice from it.

FAQ 6: Is my text sent to a server or saved anywhere?
Answer: No. The tool is written in JavaScript and runs entirely in your browser. Your text never leaves your device, nothing is uploaded and nothing is stored, so it is safe for confidential strings and test data alike.


Tools Worth Trying

TextToolz

The Ultimate Text Tools

TextToolz works seamlessly to let you convert and design your text. It is fast, reliable and secure. Trusted by thousands of users.