How to Find, Test and Collect Midjourney --sref Codes
You can find Midjourney --sref codes by generating with --sref random and noting the codes that produce styles you like, by reusing codes from your own past jobs, and by browsing curated libraries. Test each code on several different subjects before saving it, and record which model version you tested it on, because codes can render differently across versions.
What an sref code is
A style code is a number you pass to --sref instead of an image URL. Each code points to a particular visual style: a palette, a rendering technique, a mood. Add it to the end of any prompt and your subject is drawn in that style.
a fox curled up asleep in a snowy forest --ar 3:2 --sref 1234567890
Codes are short, easy to share and quick to reuse, which is why many people collect them. The catch is that a code is only useful if you know what it looks like, and that it may not look the same in a different model version. The rest of this guide is about finding good codes and keeping them organised. For how --sref works in general, see our style references guide.
Where to find codes
| Source | How it works | Pros | Cons |
|---|---|---|---|
--sref random | Midjourney picks a random style code for you | Endless supply, original finds | Most results will not suit you |
| Your own jobs | Look up the code used in a past generation you liked | Already proven on your subjects | Only covers what you have tried |
| Curated libraries | Collections of codes with preview images | Fast browsing, organised by look | Previews may come from a different version |
| Shared by others | Codes posted alongside example images | Seen in real use | Varying quality and context |
Using --sref random
Add --sref random to a prompt and Midjourney chooses a style code for that job. When the job finishes, the random value is replaced with the actual numeric code in the job’s prompt, so you can copy it and reuse it.
A good way to hunt:
- Pick a simple, neutral test subject, such as
a woman sitting by a windowora lighthouse on a cliff. - Run it several times with
--sref random, keeping everything else the same. - Skim the grids quickly. Most will be forgettable; a few will stand out.
- Open the ones you like and copy the numeric code from the job’s prompt.
a lighthouse on a cliff at dusk --ar 1:1 --sref random
Using the same subject every time makes it much easier to compare styles fairly, because only the style is changing.
Mining your own jobs
Your creation history already contains codes that worked. Search or scroll your past jobs for images you liked that used --sref, and copy the code from the prompt. These are often your best codes because you have already seen them on the kind of subjects you make.
How to test a code properly
A code that looks stunning on a portrait can fall apart on a product shot. Before you save a code as a favourite, run it through a small test set:
- A person:
portrait of a man in a wool jumper, neutral background --ar 4:5 --sref 1234567890 - An object:
a ceramic teapot on a wooden table --ar 1:1 --sref 1234567890 - A place:
a narrow street in an old town after rain --ar 16:9 --sref 1234567890 - An abstract or graphic subject:
a poster with bold geometric shapes --ar 2:3 --sref 1234567890
Then test strength. --sw runs from 0 to 1000 with a default of 100. Try a low value such as 50 and a high value such as 400 to see how the code behaves when it is a hint versus when it dominates. Some codes are subtle at default weight; others overpower everything.
Also try it with and without --style raw, since raw leaves more room for the style reference to show.
Cataloguing your codes
Codes are meaningless numbers without notes. For each code you keep, record:
- The code itself.
- A preview image, ideally from your test set.
- A descriptive name, such as "Muted risograph, teal and orange".
- Tags for mood, palette, medium and best subjects.
- The model version you tested it on.
- Preferred
--swand whether it works better with raw. - Notes on weaknesses, such as "bad with faces" or "adds clutter".
A simple naming habit helps when you have dozens of codes: describe the medium first, then the palette, then the mood. "Gouache, sage and cream, calm" is far easier to scan than a list of ten-digit numbers.
Group codes into collections by use: editorial, product, illustration, client-specific. When a code has proved itself across several projects, mark it as a favourite so you can reach it quickly.
Codes and model versions
Style codes can render differently across model versions. A code you saved under one version may look different, or very different, under a newer one. This is the most common reason a "favourite" code suddenly disappoints.
- Always note the version a code was tested on.
- When you switch versions, re-run your test set on your top codes and update the previews.
- Be cautious with codes from libraries or other people if you do not know which version their previews came from.
- For long-running client work, record the full prompt and version together so results can be reproduced. Check Midjourney’s docs for any options to use older style code behaviour in your version.
Codes can also be combined. You can usually list more than one style reference to blend looks, though the result is less predictable than a single code, so test combinations the same way.
Doing this faster with Dreamdrive
Dreamdrive keeps the full prompt with every capture, --sref code included, so a look you liked is a search away in your Library. It works inside midjourney.com in desktop Chrome, so you can save a code straight from the job where you found it.