onlinestringtools logo

String slicer

World's simplest string tool

Free online string slicer. Just enter your string and this utility will automatically extract a fragment from it. There are no ads, popups or nonsense, just a string slicer. Load a string – slice a string. Created for developers by developers from team Browserling.
announcement we've created devurls!
We just created another project – DEVURLS – world's simplest developer news aggragator. Check it out!
Slicing Range
Starting position for the slice (starts at 1).
Ending position for the slice.
Slicing Modes
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
String slicer tool What is a string slicer?
This browser-based program slices strings like a hot knife slices butter. It extracts all characters from a string that are in the range [start, end]. Both range parts are included in the match. For example, if you set the start to 4 and end to 5, and your input string is "goodjob" will turn into a substring "dj". If one of the parameters is missing, then the extracted piece extends to the last (or first) character of the string. For example, for the range [2, ⌴] we get the slice "oodjob" and for the range [⌴, 3] we get the slice "goo". Starting and ending values can also be negative. When working with negative parameters, the last element is the minus first (-1), the second to last is the minus second (-2), and so on. For example, if the range is [-3, -1] then the cropped string will be "job". Combinations of different signs are also acceptable. For example, the interval [3, -4] will turn into "od" and the interval [-3, 6] will turn into "jo". The order of letters in the output doesn't change, they always go from left to right. If you need to swap characters' positions, use the "Reverse Symbols" option. You can also use the "Multiline Slicing" option when working with multiple lines. In this case, individual strings on new lines will be sliced independently. Stringabulous!
String slicer examples Click to use
Slice a Phrase
This example slices a string using a range with positive start and length values. It starts the slice from the eleventh position, which corresponds to the letter "j", and ends the slice at the seventeenth position, which corresponds to the letter "y". As a result, this tool returns a substring with a single word "journey".
Life is a journey, not a race.
journey
Required options
These options will be used automatically if you select this example.
Starting position for the slice (starts at 1).
Ending position for the slice.
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
Slice Alphabets
In this example, we use a slicing mechanism to extract the last five letters from the Latin, Cyrillic, and Greek alphabets. As each alphabet has a different number of letters, we use the negative values in the range. The position "-1" corresponds to the last character of the alphabet and the position "-5" corresponds to the fifth letter from the end, so we're slicing backward. We also activate the multi-line slicing mode to get substrings with the last five uppercase and lowercase letters from the alphabets of three different languages.
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЮЯ абвгдежзийклмнопрстуфхцчшщьюя ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ αβγδεζηθικλμνξοπρστυφχψω
VWXYZ vwxyz ШЩЬЮЯ шщьюя ΥΦΧΨΩ υφχψω
Required options
These options will be used automatically if you select this example.
Starting position for the slice (starts at 1).
Ending position for the slice.
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
Slice Web Address
This example cleans the input web addresses from the "https" (secure http) protocol, "www" (world wide web) prefixes, and trailing slashes, and extracts just the domain names. As the beginning part of each line is the same ("https://www.") and is 12 characters long, the app sets the starting position to 13. As the end part of each line is also the same (it's a trailing slash), the app sets the ending position to -2, which is the 2nd character from the end. Thus, all characters from the beginning of the string to the 13th position, as well as the last character, are deleted, and only the domain names are returned from each line.
https://www.facebook.com/ https://www.youtube.com/ https://www.google.com/ https://www.catonmat.net/ https://www.wikipedia.org/ https://www.amazon.com/ https://www.netflix.com/
facebook.com youtube.com google.com catonmat.net wikipedia.org amazon.com netflix.com
Required options
These options will be used automatically if you select this example.
Starting position for the slice (starts at 1).
Ending position for the slice.
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
Timeline of Art Movements
In this example, we crop a timeline of art movements. Each art period is on a new line and we slice all lines at once. We set the crop range from -5 to 13. This makes the program delete the years and the last word "Art" in each string, leaving only the names of the art periods.
1300 – 1600 Renaissance Art 1600 – 1725 Baroque Art 1720 – 1760 Rococo Art 1760 – 1830 Neoclassical Art 1800 – 1850 Romanticism Art 1840 - 1870 Realism Art 1870 – 1900 Impressionism Art 1880 – 1910 Symbolism Art 1905 – 1925 Expressionism Art 1908 – 1920 Cubism Art 1909 - 1918 Futurism Art 1915 - 1945 Precisionism Art 1959 - 1960 Pop Art
Renaissance Baroque Rococo Neoclassical Romanticism Realism Impressionism Symbolism Expressionism Cubism Futurism Precisionism Pop
Required options
These options will be used automatically if you select this example.
Starting position for the slice (starts at 1).
Ending position for the slice.
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
Slice and Reverse
This example deletes tens from a list of numbers, leaving only ones, which are then reversed. It specifies only the starting position set to 8 and the utility automatically extracts all letters starting from the eighth position till the end of the string. As the "Reverse Symbols" option is enabled, all letters are printed in reverse order.
twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine
eno owt eerht ruof evif xis neves thgie enin
Required options
These options will be used automatically if you select this example.
Starting position for the slice (starts at 1).
Ending position for the slice.
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
Slice Email Addresses
In this example, we cut off the ".com" top-level domain suffix from email addresses. To do this, we use only the ending position of the range and leave the starting field empty. In this case, the application extracts all the characters from the first character to the position -5, which is the fifth character from the last.
josemu4@gmail.com car_onni@yahoo.com funnycows@outlook.com richard@google.com oster@mailinator.com geekygeek@protonmail.com dhrakarm@web.com
josemu4@gmail car_onni@yahoo funnycows@outlook richard@google oster@mailinator geekygeek@protonmail dhrakarm@web
Required options
These options will be used automatically if you select this example.
Starting position for the slice (starts at 1).
Ending position for the slice.
Slice multiple strings on multiple lines at once.
Print extracted slice in reverse.
Pro tips Master online string tools
You can pass input to this tool via ?input query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
https://onlinestringtools.com/slice-string?input=Life%20is%20a%20journey%2C%20not%20a%20race.&start=11&end=17&multi-line=false&reverse=false
All string tools
Didn't find the tool you were looking for? Let us know what tool we are missing and we'll build it!
Quickly URL-escape a string.
Quickly URL-unescape a string.
Quickly convert a string to HTML entities.
Quickly convert HTML entities to a string.
Quickly convert a string to base64 encoding.
Quickly decode a base64-encoded string.
Quickly construct a netstring from a regular string.
Quickly decode a netstring and output its contents.
Quickly quote a string with backslashes.
Quickly un-quote a backslash-quoted string.
Quickly generate a random string.
Quickly generate a string from the given regular expression.
Quickly extract all regular expression matches from a string.
Quickly check if a string matches a regular expression.
Quickly extract a fragment of a string.
Quickly create an image from a string.
Quickly apply printf (or sprintf) on strings.
Quickly split a string into pieces.
Quickly join strings together.
Quickly filter lines that match a pattern in a multi-line string.
Quickly duplicate a string multiple times.
Quickly reverse a string.
Quickly find and replace parts of a string with a new string.
Quickly truncate a string to the given length.
Quickly left-trim and right-trim a string.
Quickly pad a string on the left.
Quickly pad a string on the right.
Quickly align a string to the right.
Quickly center a string.
Quickly sort a list of strings in alphabetical, alphanumerical or numerical order.
Quickly rotate a string to the left or to the right.
Quickly convert a string to ROT13.
Quickly convert a string to ROT47.
Quickly transpose a string.
Quickly fetch a part of a string.
Quickly add a prefix to a string.
Quickly add a suffix to a string.
Quickly convert spaces to newlines in a string.
Quickly convert newlines to spaces in a string.
Quickly convert spaces to tabs in a string.
Quickly convert tabs to spaces in a string.
Quickly remove empty lines from a string.
Quickly remove spaces, tabs, and newlines from a string.
Quickly remove dots, commas, and other marks from a string.
Quickly calculate a string's length.
Quickly calculate the number of newlines in a string.
Quickly convert a string to a binary string.
Quickly convert a binary string to a string.
Quickly convert a string to an octal string.
Quickly convert an octal string to a string.
Quickly convert a string to a decimal string.
Quickly convert a decimal string to a string.
Quickly convert a string to a hexadecimal string.
Quickly convert a hexadecimal string to a string.
Quickly convert a string to ASCII codes.
Quickly convert ASCII codes to a string.
Quickly convert a string to uppercase.
Quickly convert a string to lowercase.
Quickly randomize the case of each letter in a string.
Quickly invert string's case.
Quickly extract string data from a JSON data structure.
Quickly convert a string to a JSON string.
Quickly convert a JSON stringified string to a regular string.
Quickly extract all string data from a HTML page.
Quickly extract all string data from an XML document.
Quickly convert a CSV file to evenly aligned columns of space-separated strings.
Quickly convert strings to a proper CSV file.
Quickly extract all string data from a BBCode markup.
Quickly convert a string to Morse code.
Quickly convert Morse code to a string.
Quickly create a palindrome from a string.
Quickly check if a string is a palindrome.
Quickly generate all monograms of a string.
Quickly generate all digrams of a string.
Coming soon These string tools are on the way
Replace Multiple Strings
Replace a set of strings with a new set.
Title-case a String
Convert a string to a title with proper titlecase.
Capitalize Words in a String
Convert the first letter of every word in a string to uppercase.
Justify a String
Stretch out a string and Align it along the left and right margins.
Format a Multi-line String
Format and align a multi-line string.
Number of Letters in a String
Find how many letters there are in a string.
Number of Words in a String
Find how many words there are in a string.
Number of Lines in a String
Find how many lines there are in a multi-line string.
Number of Paragraphs in a String
Find how many paragraphs there are in a multi-line string.
Sort Words in a String
Sort all words in a string alphabetically.
Sort a Numeric String
Sort a string that contains only numbers.
Reverse Words in a String
Reverse the order of all words in a string.
Reverse Sentences in a String
Reverse the order of all sentences in a string.
String Frequency Analysis
Find most frequent letters, words and phrases in a string.
Create String Mnemonic
Generate a mnemonic for words in a string.
Number a Multi-line String
Add line numbers to a multi-line string.
Wrap a String
Wrap strings to the given line length.
Chunkify a String
Split a string into chunks of certain length.
Shuffle Words in a String
Shuffle the order of all words in a string.
Extract Emails from a String
Find and extract all email addresses from a string.
Extract URLs from a String
Find and extract all web addresses from a string.
Extract Numbers from a String
Find and extract all numbers from a string.
Generate String Statistics
Analyze string's complexity.
Convert a String to Punycode
Encode a string to punycode.
Convert Punycode to a String
Decode a string from punycode.
QP-encode a String
Convert a string to quoted-printable encoding.
QP-decode a String
Convert quoted-printable encoded data to a string.
Base32-encode a String
Encode a string to base32.
Base32-decode a String
Decode a string from base32.
Base58-encode a String
Encode a string to base58.
Base58-decode a String
Decode a string from base58.
Base85-encode a String
Encode a string to Ascii85.
Base85-decode a String
Decode a string from Ascii85.
UTF8-encode a String
Encode a string to UTF8.
UTF8-decode a String
Decode a string from UTF8.
UTF16-encode a String
Encode a string to UTF16.
UTF16-decode a String
Decode a string from UTF16.
UTF32-encode a String
Encode a string to UTF32.
UTF32-decode a String
Decode a string from UTF32.
IDN-encode a String
Encode a string to IDN.
IDN-decode a String
Decode a string from IDN encoding.
Uuencode a String
Convert a string to Unix-to-Unix encoding.
Uudecode a String
Convert Unix-to-Unix data to a string.
Xxencode a String
Convert a string to Xxencoding.
Xxdecode a String
Convert an Xxencoded string to a regular string.
HTML-strip a String
Strip all HTML tags from a string.
Remove Accent Characters
Remove all diacritical signs from a string.
Remove Duplicate Spaces
Normalize string spacing and remove all duplicate spaces.
Diff Two Strings
Visualy compare and find differences between two strings.
String Levenshtein Distance
Calculate Levenshtein distance between two strings.
Rewrite a String
A tiny string rewriting system.
Generate a Zalgo String
Convert a string to Unicode mess.
Generate String Typos
Create a list of all possible string typos.
Mirror a String
Generate a mirror copy of a string.
Generate Trigrams
Generate all 3-grams of a string.
Generate all N-grams
Generate all ngrams of a string.
Generate N-skip-M-grams
Generate n-skip-m-grams of a string.
Tokenize a String
Create a list of tokens from a string.
Lemmatize a String
Lemmatize all words in a string.
Stem a String
Do stemming of all words in a string.
Grep a String
Extract fragments that match a regular expression in a string.
Head a String
Split a string into fragments and extract the beginning parts.
Tail a String
Split a string into fragments and extract the ending parts.
Convert a String to an Array
Create an array of characters from a string.
Convert a String to Integers
Split a string into characters and return their integer values.
Shift a String
Shift characters in a string to the left or right.
Slugify a String
Create a SEO-friendly URL from a string.