# “Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with , and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of Wikipedia (the Wikipedia entry has been deleted but there is a copy at archive.org ), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

## The Rules

• Each submission must be a full program.
• The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.
• The program must not write anything to STDERR.
• If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

• Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
• This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".
• If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

## The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

## Language Name, N bytes


where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes


If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes


You can also make the language name a link which will then show up in the snippet:

## [><>](https://esolangs.org/wiki/Fish), 121 bytes


/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(a) {
});
comment_page = 1;
}
});
}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(c) {
if (c.owner.user_id === OVERRIDE_USER)
});
else process();
}
});
}

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

function getAuthorName(a) {
return a.owner.display_name;
}

function process() {
var valid = [];

var body = a.body;
if(OVERRIDE_REG.test(c.body))
body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
});

var match = body.match(SCORE_REG);
if (match)
valid.push({
user: getAuthorName(a),
size: +match[2],
language: match[1],
});
else console.log(body);
});

valid.sort(function (a, b) {
var aB = a.size,
bB = b.size;
return aB - bB
});

var languages = {};
var place = 1;
var lastSize = null;
var lastPlace = 1;
valid.forEach(function (a) {
if (a.size != lastSize)
lastPlace = place;
lastSize = a.size;
++place;

.replace("{{NAME}}", a.user)
.replace("{{LANGUAGE}}", a.language)
.replace("{{SIZE}}", a.size)

var lang = a.language;
lang = jQuery('<a>'+lang+'</a>').text();

languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
});

var langs = [];
for (var lang in languages)
if (languages.hasOwnProperty(lang))
langs.push(languages[lang]);

langs.sort(function (a, b) {
if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
return 0;
});

for (var i = 0; i < langs.length; ++i)
{
var language = jQuery("#language-template").html();
var lang = langs[i];
language = language.replace("{{LANGUAGE}}", lang.lang)
.replace("{{NAME}}", lang.user)
.replace("{{SIZE}}", lang.size)
language = jQuery(language);
jQuery("#languages").append(language);
}

}
body {
text-align: left !important;
display: block !important;
}

width: 290px;
float: left;
}

#language-list {
width: 500px;
float: left;
}

font-weight: bold;
}

table td {
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="language-list">
<h2>Shortest Solution by Language</h2>
<table class="language-list">
<tr><td>Language</td><td>User</td><td>Score</td></tr>
<tbody id="languages">

</tbody>
</table>
</div>
<tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>

</tbody>
</table>
</div>
<table style="display: none">
</tbody>
</table>
<table style="display: none">
<tbody id="language-template">
</tbody>
</table>

• @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. – Martin Ender Aug 28 '15 at 13:56
• If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? – aditsu Aug 28 '15 at 15:33
• @mbomb007 Well it's hidden by default because the three code blocks take up a lot of space. I could minify them so that they are a single line each, but I'd rather keep the code maintainable in case bugs come up. – Martin Ender Aug 28 '15 at 19:34
• @ETHproductions "Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge." Publishing the language and an implementation before posting it would definitely be helpful though. – Martin Ender Aug 29 '15 at 23:01
• @MartinEnder ... Almost. If two BF solutions have the same size, the one with smaller lexicographical order will take smaller number of bytes in Unary. Of course the smallest Unary solution translated to BF is guaranteed to be smallest. – user202729 May 20 '18 at 10:20

# MY, 73 bytes

Here's the hex:

07 24 21 21 28 26
0A 24 21 28 26
0B 24 20 20 28 26
0B 24 20 20 28 26
0B 24 21 28 26
04 24 21 21 21 21 28 26
02 25 28 26
09 24 20 20 20 28 26
0B 24 21 28 26
07 25 21 21 28 26
0B 24 20 20 28 26
0A 24 28 26
02 25 21 28 26


I didn't want to update my old answer, because this one isn't just a simple one-byte solution that uses a builtin.

How it works: Outputs each character by using the few commands I have interpreted:

• Number Literal: 0x00 - 0x0F
• Minus 1: 0x20
• Times 10: 0x24
• Times 16: 0x25
• Output: 0x26
• Character value: 0x28

# Chip, 174166106 97 bytes

94 bytes for the code + 3 bytes for the flag (-w) which allows execution without input.

!ZZZZZZZZZZZZt
|))))))x)))))f
|)xx)x-))xxxa
|)))))-))x))c
)))))x-))))g
)-))))-x)xd
b e^b^e


Try it online!

Chip is a 2D language inspired by integrated circuits, input and output are broken down into individual bits which travel through gates and across wires.

Ungolfed (134 bytes):

!ZZZZZZZZZZZZt
xxxxxxxxxxxxxh
)))))xx)))))xg
x))))))x)))))f
xxxxxxx)x)xxxe
)x))))xx)x)xxd
x)))))x))x))xc
xxxx)xx)))xxxb
x)xx)xx))xxx)a


How the ungolfed version works:

This implementation encodes the target string Hello, World! as a bit matrix, somewhat reminiscent of core memory. The leftmost column of )'s and x's corresponds to H in the output, the rightmost column to !. The ) is an Or-gate (mapping to a 1 in the output), and the x is a wire crossing (mapping to a 0).

The first row is for timing, and the remaining rows are for each of the bits of the output (the row ending in h is the highest bit, and a is the lowest).

The timing behavior starts with the !. ! produces a single 1-cycle pulse at the beginning of execution. The line of Zs then control the left-to-right propagation of the signal at a rate of one element per cycle, each one corresponding to the transition between consecutive letters of the output. Each Z also sends a signal to the column below. At the end of the timing row is t, which terminates the program, preventing infinite output of null characters at the end.

In the first cycle, the first data column is powered. We see OR-gates ()) on the rows for bits d and g, turning them on; the remaining bits stay off because the wire crosses (x) won't propagate the signal from the top to the left. This gives us 01001000, which is H.

In the next cycle, only the second data column is powered. Rows a, c, f and g turn on much like the bits in the first cycle, and the remaining bits are off. This gives us 01100101, which is e.

This continues all the way across to the right, giving the remainder of the output.

Golfing it:

There's not a lot that could be done here, but there are a few things of note:

• The h row is always off, so that can be eliminated.
• Each row can be trimmed on both ends, removing unnecessary x's, so long as the timing signal can still be propagated downward to rows that need it below. This is why the rows are rearranged; to maximize the trimming that can occur.
• The construct )a is equivalent to simply a, so long as the signal did not need to be propagated downward from the OR-gate.

All other changes are just mashing things around to save single bytes.

# Pyramid Scheme, 857 bytes

  ^      ^      ^     ^      ^      ^      ^      ^      ^      ^      ^      ^      ^
/ \    / \    / \   / \    / \    / \    / \    / \    / \    / \    / \    / \    / \
/out\  /out\  /out\ /out\  /out\  /out\  /out\  /out\  /out\  /out\  /out\  /out\  /out\
-----^ -----^ -----^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^-----
/ \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \
/chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\
^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^-----
/ \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \
/72 \  /101\  /108\  /111\  /44 \  /32 \  /87 \  /111\  /114\  /108\  /100\  /33 \
-----  -----  -----  -----  -----  -----  -----  -----  -----  -----  -----  -----


Try it online!

Wow. At least it's kinda clear how this works...

# Windows Portable Executable (PE), 1175 bytes

By using the following Assembly code instead of C code (which inevitable imports unecessary libraries and whatnot), we can cut down the executable size from 261591 bytes (compiled C answer) to a measily 1536 bytes.

extern ExitProcess, GetStdHandle, WriteConsoleA

section .n
msg db "Hello, World!",10

; <entry point>
Start:
; GetStdHandle(in A1)
push -11           ; A1 - STD_OUTPUT_HANDLE
call GetStdHandle  ; Puts in eax

; WriteConsole(in A1, in A2, in A3, out A4, reserved A5 )
push 0             ; A5 - Don't care (reserved argument)
; A4 - Don't care ("number of chars written")
push 14            ; A3 - Length ("number of chars to write")
push msg           ; A2 - String (buffer pointer)
push eax           ; A1 - Console output handle (from GetStdHandle)
call WriteConsoleA

; ExitProcess(in A1)
push 0             ; A1 - Exit code
call ExitProcess


However, that is still way too large. So I installed HxD, a hex editor, and went on to try and remove unecessary parts.

Apparently, Windows' executables are filled with padding (hex indication) for no apparent reason. So I removed the tailing block of zeroes at the end of the file, messed around a bit, and managed to cut it down to 1175 bytes. Here's the pastebin hexdump of the executable.

Unfortunately, at my every attempt to remove the other paddings (0x1A8-0x1FF, 0x22B-0x3FF), the program would simply not run. I've been doing this for a few days to no success. Thus, I'm posting this beaten, at the still staggering 1KB of size.

I am sure this can be golfed even further, so if anyone manages to cut down the size, feel free to edit this answer or perhaps even post another one.

As a bonus, this executable also works on DOS.

• If anyone wants to try golfing this down some more, they may find this answer on SO and the material it references helpful. – 3D1T0R May 29 '18 at 19:53
• github.com/pts/pts-tinype Some smaller Hello World .exes, not mine. I couldn't get the 268-byte ones to run at all, and the 402-byte one would only run with my antivirus shut off. – Nnnes Jul 23 '18 at 11:19

# Magic Number, 174 bytes

0010000033001000010000100001080010000114001000011100100000870010000032001000004400100001110010000108001000010800100001010010000072006006006006006006006006006006006006006006


Magic Number is a simple human-writable stack-based esolang where the source code consists of a single positive integer. The decimal digits are read from most significant to least significant.

The only two commands used here are 0010xxxxxx, which pushes the non-negative integer xxxxxx onto the stack, and 006, which pops the stack and prints the character with that character code. The program pushes the numerical value of the characters in "Hello, World!" onto the stack in reverse order and prints them all. Branching is fairly expensive, so I feel this is probably optimal.

• Welcome to PPCG! – Martin Ender Aug 13 '17 at 17:35

# Sad-Flak, 199+3 bytes = 202 bytes

3 bytes for the -A arg. This lang uses a "codepage", where ≤≥ are one byte each (that is, I have a thing that replaces  and ~ with those chars and runs it)

32
({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥


Try it online!

## Explanation:

The main idea behind this is that the way Sad-Flak works, you can easily get it to repeat a line a constant number of times.

in Sad-Flak, there is a line pointer. The line pointer starts at the beginning

-> 32
({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥


however, the 32 is not actually a command. it is a simple way to express 32 blank lines. I could expand them for the demonstration, but then it would be unreadable. anyway.

So, the line pointer points at the first of 32 blank lines. When the line pointer points at a non-blank line, it will execute that line. when the line pointer points at a blank line, it will execute the first non-blank line after that line. that means we execute ({}≤()≥). What does this line do? This lang is a brainflak derivative, btw, so some of the brackets do the same thing, but not all

(        push...
{}      pop off the main stack and evaluate to that value, plus
≤     jump by the amount inside, evaluate to that value for the purpose of other commands
()   1
≥
)


so, this pops off the stack, adds one to it while jumping one forward, then pushes back on the stack. What is jumping? why are we jumping in the middle of a line?

Jumping in Sad-Flak is rather different to most other langs. Jumping does not take immediate effect, but rather moves the line pointer. when the line pointer is moved, nothing happens until the current line is finished executing. when it is finished, we see which line the line pointer points at, and execute that. If the line pointer didn't get moved, the same line gets executed again, and again, until it gets moved. however, all lines in this program either are blank, or they jump or halt. So, this line moves the line pointer one forward and increments top of stack.

What is the line pointer pointing at now? it's still on a blank line, so it does the same thing again, and again, until it gets to the line that it keeps executing

   32
-> ({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥


Then, it executes it one last time, before moving to the next line. this end up with the charcode of ! on the stack (32 blanks + 1 actual line)

   32
({}≤()≥)
-> (≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥


this line ((≤()≥)) pushes a new 1 to the stack, and moves the line pointer one forward, onto a new blank line, to do basically the same thing as it did before. however it puts charcode of e. and also the next line is this: ((<>[≤()≥])). What is this complex line? well:

((        push twice...
<>      value popped from stack, and pushed onto the offstack for later retrieval
[     minus ...
≤    (jump but eval to the argument still)
()  1
≥
]
))


so, this pops the e off the stack, and replaces it with two ds, while leaving an e on the off stack for later retrieval, and also jumping the line pointer to the next line. we have two, because one will be changed into l, because it saves bytes from pushing a 1 and incrementing it up to the next letter. we don't do this for all of them because it also cost bytes popping and pushing back onto the stack, as well as fitting the jump in there.

from now on, I'm skipping the blank lines and the increment top of stack lines, because this explanation is long enough already.

after adding 8 to yield l

((          push twice...
<>        a value popped from stack, also pushed to offstack
))
≤     jump ...
()   1
≥


add 6 to yield r: this one again: (≤()≥) new value at 111 (o):

(           push...
<>         popped value, also pushed to offstack.
)
(       push...
≤      (jump and eval to same as...)
()    1
≥
)


so this pushes to the off stack while keeping it on the stack, and pushing another 1 on the stack.

new 87 (W): this again: (≤()≥)

new 32 (space): same again: (≤()≥)

new 44 (,): ({≤()≥})(({()}))({()})(()) woah, what is that? put simply, it is just pushing onto the main stack what we pushed on to the offstack, then a 1 to make into a H:

(             push...
{            pop from the off stack, evaluate to that multiplied by...
≤           jump and eval to...
()         1
≥
}
)         this pushes o

((         push twice...
{        multiply an offstack popped value by...
()      1
}
))     this pushes l twice

(        push...
{       offstack popped value times...
()     1
}
)      this pushes e

(    push...
()  1
)


new 72 (H): ≤≥: this is the halt command and it stops the program

That pushed !dlroW ,olleH char codes, which then gets printed, but backwards because it is a stack. "Hello, World!"

# Pain-Flak, 152 bytes

)))))}{}{)))}{))(}{((((])][][][([(])()()([((]][[()()()(])}{][][)][(][([())(]][][][][][[))(]][[)][][)][][][][))(}{}{))))(}{)}{)}{))()()()((((((((((((}><{


This is a trivial modification of @HeebyJeebyMan's “Hello, World!” in Brain-Flak. They also discovered a slightly different solution with the same length shortly before I golfed mine down to this byte count.

Try it online!

### How it works

Pain-Flak is transpiled to Brain-Flak as follows.

• Let the Pain-Flak source code be S.
• Transliterate S, replacing all opening brackets with their closing counterparts and viceversa. Call the result T.
• Reverse S character by character. Call the result R.
• The Brain-Flak source code is T || R, where || symbolizes concatenation.

For the Pain-Flak program in this answer, transpilation yields the following Brain-Flak program.

((((({}{}((({}((){}))))[([][][])])[()()()]))[[]])()()()[({}[][]([])[])])(()[[][][][][]](()[[]]([][]([][][][]((){}{}((((){}({}({}(()()()())))))))))))
{<>}
{<>}
(((((((((((()()()()){}){}){}()))){}{}())[][][][])[][])[[]]())[[][][][][]]())([([]([])[][]{})]()()()([[]](([()()()]([([][][])](((({}()){}))){}{})))))


Newlines have been inserted for "readability". The programs works as follows.

• Line 1 pushes garbage on the first stack.

• {<>} on line 2 switches stacks until the top of the stack is non-zero.

This switches to the second stack.

• {<>} does the same. Since the top of the second stack is 0, we stay on the second stack.

• Line 4 is just @HeebyJeebyMan's “Hello, World!” in Brain-Flak, which never switches stacks and is, therefore, unaffected by the garbage on the first stack.

• You care if i use the pain-flak description for my readme? – Christopher Jan 21 '18 at 0:17
• @Christopher2EZ4RTZ Go ahead. :) – Dennis Jan 21 '18 at 0:19

# Brain-Flak, 144 138 bytes

((((((((((((()()){}){}){}){}()))){}{}())([][]){})[][])[[]]())[((()[]){}){}])([()[]](([]([](([][]([](()[][]){})))[]{}[])[[]])))(([][][]){})


Try it online!

The product of my code from the Text to Brain-Flak challenge. Beats the previous answer by 4 bytes! Wheat Wizard has since updated to beat mine by 2. And my code has produced a 140 byte solution (which I've golfed a further 2 bytes off).

Explanation coming as soon as I understand it myself...

### How It Works:

Note that Brain-Flak is a stack based language which outputs the stack on exit. This means the text has to pushed to the stack in reverse.

((((((((((((()()){}){}){}){}()))){}{}())([][]){})[][])[[]]())[((()[]){}){}])


This first part pushes "World!". This part is actually near identical to Wheat Wizard's answer, and has the same byte count.

( Pushing "W"
( "o"
( "r"
( "l"
( "d"
( "!"
(((((
(()()) Push 2
{}) Pop the 2 to push 4
{}) Pop the 4 to push 8
{}) Pop the 8 to push 16
{}()) Pop the 16 and create a 1 to push 33 ("!")
)){}{}()) Create two copies of 33 and pop them to push 99 and a 1 to push 100 ("d")
([][]) Push the stack height (2) twice to the stack
{}) Pop the 4 and push 8 + 100 = 108, ("l")
[][] Add the stack height (3) twice to the current value
) Push 108 + 3*2 = 114 ("r")
[[]]() Add negative stack height (4) and 1 to the current value
) Push 114 + (-4) + 1 = 111 ("o")
[ Subtract
(
(()[]) Push stack height (5) + 1
{}) Pop the 6 to create 12
{} Pop the 12 to create 24
]) Push 111 - 24 = 87 ("W")


This part pushes "ello, "

([()[]](([]([](([][]([](()[][]){})))[]{}[])[[]])))

( "e"
[()[]] Save negative stack height (6) and 1 for later (-7)
( "l"
( "l"
[] Save stack height (6) for later
( "o"
[] Save stack height (6) again
(( ","
[][] Save stack height (6) twice (12)
( " "
[] Save stack height (6)
(()[][]){} Push 1 + stack height (6)*2 = 13 and double it = 26
) 26 + 6 = 32 (" ")
) 32 + 12 = 44 (",")
)[]{}[] Add the stack height (9), pop the 44 and add the stack height again (8)
) 44 + 9 + 44 + 8 + 6 (saved) = 111 ("o")
[[]] Subtract stack height (9)
)) Push 111 - 9 + 6 (saved) = 108 ("l") twice
) Push 107 - 7 = 100 ("e")


And finally (([][][]){}) pushes "H" by adding the stack height (12) three times and doubling it.

# Inform 7 + C by G, 36 bytes

Include C by G.Z:say "Hello, World!"


This code requires at least version 1/150829 of the code golfing extension.

• I got rid of my old version. – Lynn Aug 29 '15 at 5:20
• Please change the language name to "Inform 7 + C by G", since you're using a library – ASCII-only Apr 20 '18 at 1:22
• @ASCII-only As the cost of the library is included I don't think that's necessary. – curiousdannii Apr 20 '18 at 1:34
• @curiousdannii nope, it's still necessary (at least for libraries that don't come with the standard distribution) – ASCII-only Apr 20 '18 at 2:48

# Whirl, 955 733 bytes

-~200 bytes using implicit modulo when output magic - I haven't checked anywhere close to all the simple possibilities, so this might be very suboptimal.

It might be possible to use memory/the operations wheel value as extra storage to make things shorter, but all approaches I've tried using those are not golfier than the naive one

1100001110010001111100110000000000000100000100000100000110000010000100100010001000000000000111110001111000111110001111000000000000011110000011100100011001111110001110011111000000000000000000000000000100100110000001111110001110011111000000000001001000100010000000000001111100000111110001001000110001000111110000011110000000000000000010001001100111111000100111110011000000000000000000000000010000011000000000110010001100010000000000011111000001111000000000000000000111110001111000111110001111000001001001100111111000111001111100000000000100100111001111110001111001111100000000000000000000000111100000111001000111001111110001111001111100000000000000000000000000000001111000001110010010001000000000000000000000000111110000011111000100100


Try it online!

1 _
: ; _ + _ + _ + _ : _ + _ : _ * _ + _ : .
+ _ + _ + _ + : - _ + _ + _ + _ - _ : . _ :
+ _ + _ + _ + _ + _ + _ + _ : . _ . _ :
+ _ + _ + _ : .
+ _ + _ + _ + : + _ : .
* _ - _ + _ + _ + _ + _ : . _
: ; _ + _ + _ + _ + _ + _ + _ : _ * _ * _ : .
* _ * _ * _ - _ + _ + _ + _ + _ + : - _ + _ : . _ :
+ _ + _ + _ : . - :
+ _ + _ + _ + _ + _ + _ - _ : . - :
+ _ + _ + _ + _ + _ + _ + _ + _ - _ : .
+ _ + _ + _ + _ + _ + _ + : + _ : .


Every command switches operation wheels, starting from the operation wheel. Note that the cost depends on the current and previous command of the wheel, which is why there are so many no-ops.

Each character is on its own line, except for the two ls in a row. Some constructs used here are:

• : ; - load the 1 from operation value into math value
• _ + - add memory to math value - this can be used for e.g. repeated additions to emulate multiplications
• _ * - square. This is used for H since 72 = 8 * 8 + 8
• : . _ - store math value to memory, output, switch back to math wheel

Lines ending with : indicate the 1 from the operation wheel is being loaded, but the math value is not being overwritten. This is useful when consecutive characters are close in character codes.

### Operation wheel commands

• 1 - set (operation) value to 1
• : - store value into memory. In this program it's always 1
• . - output chr(memory)

### Math wheel commands

• + - add memory to (math) value - this is different to operation value
• * - multiply memory with value
• - - negate value - this is the only way to subtract
• ; - load memory into value
• : - store value into memory

See the language page for descriptions of unused commands

Try it online!

• :| this is shorter than the all-caps no-punctuation one here (official website). is everyone bad at golfing or do i just have no life? also i have absolutely no clue how to contact the author – ASCII-only May 6 '18 at 5:08

Logo (programming language) - 20 bytes

PRINT [Hello, World!]


Or even more exciting version:

to helloworld
hideturtle
fd 20 left 180
fd 40 left 180
fd 20 right 90
fd 20 left 90
fd 20 left 180
fd 40 left 90
fd 20 left 90
fd 20 right 90
fd 20 right 90
fd 10 right 90
fd 20 left 90
fd 10 left 90
fd 30 left 90
fd 40 left 180
fd 40 left 90
fd 20 left 90
fd 40 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 60 left 90
fd 40 left 180
fd 40 left 90
fd 20 left 90
fd 20 left 180
fd 20 left 90
fd 20 left 90
fd 40 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 40 left 90
fd 20 right 90
fd 20 right 90
fd 5  left 90
fd 5  left 90
fd 25 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 40 left 180
fd 40
end

lt 90 pu fd 200 pd rt 90 helloworld


Output:

• Welcome to PPCG! This is code golf, so you should make sure that your answer is as short as possible. I don't know Logo, but it seems the HELLO is an arbitrary identifier, so you can probably shorten it and maybe it's also possible to get rid of some of that whitespace? Also, please use the required spelling Hello, World! and include the byte count of the code in your answer so that people can easily see its score. – Martin Ender Apr 10 '18 at 15:04
• First-timer here. Cool, thanks. – Artur Kędzior Apr 10 '18 at 15:09
• Hmm. I think you should stop drawing in between letters – ASCII-only May 18 '18 at 10:02

# Symbolic Python, 175 157 147 136 bytes

_=-~(_==_)
_*=_-~_
__=_*_+~-~-_
_=('%'+''[~_/_])*-~-~_%(~-_*~-~-_,_*_+_/_,__,__,_*_-~_,',',' ',__-_+~_,_*_-~_,_==_[_/_],__,_*_)+'!'


Try it online!

I'm not sure this is optimal, but it sure was fun.

### Explanation:

_=-~(_==_)           # Set _ to 2
_*=_-~_              # Set _ to 2*(2+2+1) = 10
__=_*_+~-~-_         # Set __ to 10*10+(10-1-1) = 108
_=                   # Set _ to
('%'+''[~_/_])      # %c, where c is coming from the character \x0c
*-~-~_                # Repeated 12 times
%(...                 # Then format into that format string
~-_*~-~-_,              # (10-1)*(10-1-1) = 72  = 'H'
_*_+_/_,                # 10*10+1         = 101 = 'e'
__,                     #                   108 = 'l'
__,                     #                   108 = 'l'
_*_-~_,                 # 10*10+10+1      = 111 = 'o'
',',                    #                         ','
' ',                    #                         ' '
__-_+~_,                # 108-10-(10+1)   = 87  = 'W'
_*_-~_,                 # 10*10+10+1      = 111 = 'o'
_==_[_/_],            # second letter of True = 'r'
__,                     #                   108 = 'l'
_*_                     # 10*10           = 100 = 'd'
)+'!'                   # Then add the last char    '!'
# And implicitly print _


# whenyouaccidentallylose100endorsementsinnationstates -  900  761  728  552  260 bytes

20280782166
114
fff#dff#dfffff#dfffffffffff#dfffffffffffffff#dffffffffffffffffffffffffffffffffff#dfffffffff#dfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff#dffffffffffffffffffffffffff#dfffffffffffffffffff#dffff#dffffffffff#dfffffffffff#d


Try it online!

Golfed down to 761 bytes by increasing the brute-forcer to seeds up to 9999, instead of 999

Golfed down to 728 bytes by increasing the brute-forcer to seeds up to 99999, instead of 9999

Golfed down to 552 bytes by increasing the brute-forcer to seeds up to 999999, instead of 99999

Golfed down to 260 bytes with the help of @ASCII_only

• I'm very curious as to what the inspiration for this languages name is. – Gabriel Mills Feb 6 '19 at 2:38
• @GabrielMills Explained here to Dennis – MilkyWay90 Feb 6 '19 at 2:42

# C++ (gcc), 40 bytes

main(){__builtin_puts("Hello, World!");}


Try it online!

Using builtins are shorter since #include takes up a lot of bytes. I believe this solution is optimal.

• "Optimal?" A bold claim. Ken Thompson: "Last year I taught at University of Sydney I gave that to my class, the shortest self-reproducing program in C, and I got a surprise. I didn't think there was a surprise there to be had. But, I got somebody who has the shortest one I've ever seen, which is a record breaker, by about four characters of what I had proved to myself was the shortest program, and they did it by a totally different mechanism which of course nullified the proof." princeton.edu/~hos/mike/transcripts/thompson.htm – roblogic Aug 27 '19 at 1:53

# Jasmin, 251219 165 bytes

Jasmin is an assembler for the Java Virtual Machine. It takes ASCII descriptions of Java classes, written in a simple assembler-like syntax using the Java Virtual Machine instruction set. It converts them into binary Java class files, suitable for loading by a Java runtime system.

.class H
.super sun/misc/MessageUtils
.method public static main([Ljava/lang/String;)V
ldc "Hello, World!"
invokestatic H/out(Ljava/lang/String;)V
return
.end method


Compile with java -jar jasmin.jar H.j. Execute byte code with java H.

This program is based off the "Hello, World!" program by pearce at SJSU. Golfing mainly entailed removing comments and unnecessary white space (this was true four years ago but, I have since made substantial changes). Something interesting I noted while golfing it is that a class file doesn't have to include a constructor. When a normal Java program doesn't have a constructor, a default is provided but. When there is no constructor in Jasmin, the resulting class file doesn't have one either. This would probably result in issues when trying to instantiate the class but, for the purpose of executing the main method, it works fine.

# 4 Years Later Golfs

1. I found out about the static method sun.misc.MessageUtils.out from this answer. Using this instead of System.out.print saves quite a few bytes because calling instance methods is rather expensive in Jasmin.
2. Extending sun.misc.MessageUtils saves even more bytes on that invokestatic because I can write H instead of the fully qualified class name. Omitting the .super line is not an option in Jasmin so, the other option would be extending a class with a short fully qualified name (e.g. java/io/File.

# Non-competing golfs

1. You can omit return if you invoke the class with java -noverify. This causes the JVM to segfault after printing "Hello, Word!". (-7 bytes)

2. I think I should be able to use a static initializer instead of a main method if I execute the class file with Java6 but, I can't get this to work. It would be done by replacing the header for main with .method public static <clinit>()V.(potentially -15 bytes)

# unc, 38 bytes

ZNVa[]<<chgf[L'uRYYb~ JbeYQ#']:if 5:>>


# Scala, 22 bytes

print("Hello, World!")


scala can run "scala scripts" which are not full program. you can save the above to a file and execute in the shell scala file.scala, and it will execute (shortcut without saving a file: scala -e 'print("Hello, World!")').

a full ordinary scala program that prints hello world:

object H extends App{print("Hello, World!")}


# Nim, 20 19 bytes

echo"Hello, World!"


Saved one byte thanks to sp3000!

• You can drop the space in between for the first one, I think :) – Sp3000 Aug 28 '15 at 15:09
• Indeed, saved me one byte! – kvill Aug 28 '15 at 15:18

# Emily, 22 bytes

println"Hello, World!"


This is a nice little language I stumbled upon recently.

# Applescript, 15 bytes

"Hello, World!"


Normally a fairly verbose language, for this one this is all that is required.

• It's nice to see these verbose languages -- Applescript, PHP, PowerShell, etc. -- getting the better of lots of other languages for once. :) – AdmBorkBork Aug 28 '15 at 15:53
• @TimmyD That doesn't mean that they are good languages. It's just that they are better at some things. – georgeunix Aug 28 '15 at 16:53
• @georgeunix Oh, without a doubt. Every language has its pluses and minuses. There are plenty of things I'd change about PowerShell, but there's nothing else I'd rather use to script and config Exchange. Even if it had commands and functionality to do so, I don't think I could use Pyth or CJam or whatnot on a day-to-day basis instead. I was just meaning "It's nice to see non-golfing languages toward the top of the lowest-byte-count list for a change." – AdmBorkBork Aug 28 '15 at 17:06
• I understand @TimmyD – georgeunix Aug 28 '15 at 17:07

# VBScript, 28 Bytes

WScript.Echo "Hello, World!"


This (should be) the shortest that prints to STDOUT (i.e., the command prompt window), when executed via command prompt wscript .\hello-world.vbs or cscript //nologo .\hello-world.vbs (the //nologo is necessary to prevent copyright info from being displayed). If you just double-click it, you'll get a pop-up message box instead, similar to the shorter example, below, at 22 bytes:

MsgBox "Hello, World!"


When executed, this second option will output a pop-up message box displaying the text inside the quotes. Since it's not technically STDOUT, and we do have a legitimate way to display STDOUT, we'll count the longer version instead.

# Ook!, 949 Bytes

Just translated one of the Brainfuck answers here.

Ook! Ook! Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook.
Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook. Ook. Ook. Ook? Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook! Ook. Ook? Ook! Ook! Ook! Ook! Ook! Ook?
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook.
Ook! Ook! Ook? Ook! Ook! Ook! Ook? Ook. Ook. Ook.
Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook! Ook! Ook!
Ook! Ook! Ook! Ook! Ook! Ook. Ook. Ook? Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook! Ook!
Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook.
Ook? Ook. Ook! Ook. Ook? Ook. Ook! Ook. Ook? Ook.
Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook! Ook! Ook. Ook? Ook. Ook! Ook! Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.

• I always smile when I see this language. – AdmBorkBork Aug 28 '15 at 16:36
• This might be a case of "If your language of choice is a trivial variant of another (potentially more popular) language...". The shortest Ook! program will always be the translation of the shortest BF program (because each BF character is converted to the same length in Ook). So if Ook has a separate answer it needs to be updated every time someone finds a new shortest Brainfuck solution. (Ultimately, it's your call though if Ook should remain separate.) – Martin Ender Aug 28 '15 at 17:06
• I love reading the "Code" in a manner as if two people were talking to each other :) – MrPaulch Aug 29 '15 at 11:12
• @MrPaulch I agree. The fact that first O is capitalized makes it sound like a fast Oh, okay with vocalized differences for punctuation in my mind. – mbomb007 Sep 1 '15 at 15:04

# Octave, 19 bytes

disp"Hello, World!"


# Vim, 17 bytes

iHello, World!{ESC}ZZ


Where {ESC} is a raw escape byte \x1b.

This will switch to insert mode (i), write Hello, World!, leave it (ESC), and save+quit (ZZ). An environment like vimgolf or anarchy golf has to do the output part for you, as Vim is, of course, just a text editor.

• @LegionMammal978 the other seems to be Vimscript mislabelled as Vim. – primo Feb 26 '16 at 18:33
• I think generally the standard is that vim solutions don't have to save and quit, they can just display the text onscreen at the end. (That's what mine have all done). This would allow you to take 3 bytes off. – DJMcMayhem Jun 29 '16 at 17:33
• Way longer and wrong output, but more interesting: :h_4<CR>/"H<CR>ly2wZZp – BlackCap Oct 12 '17 at 19:22

# TI-BASIC, 22 bytes

"Hello, World!


Note that the lowercase letters are 2 bytes each.

• I don't think the initial : is really part of the program, so I think this has a score of 22. – Ypnypn Aug 28 '15 at 16:06
• @Ypnypn I'll take your word on it :) – TheNumberOne Aug 28 '15 at 18:45

# PARI/GP, 22 bytes

print("Hello, World!")


# 4, 117 bytes

3.6000160103602136033260433605446067260787008070200908000120902111120111011015065095105105115055035075115125105085044


### How it works

Generating characters with a code point below 100 is straightforward.

I've managed to create the others (derol) with three assignments and five additions/subtractions, which I believe is optimal.

3.            Begin the program.
6 00 01     Set cell[ 0] to 1.
6 01 03     Set cell[ 1] to 3.
6 02 13     Set cell[ 2] to 13.
6 03 32     Set cell[ 3] to 32 = ' '.
6 04 33     Set cell[ 4] to 33 = '!'.
6 05 44     Set cell[ 5] to 44 = ','.
6 06 72     Set cell[ 6] to 72 = 'H'.
6 07 87     Set cell[ 7] to 87 = 'W'.
0 08 07 02  Set cell[ 8] to cell[ 7] + cell[2] =  87 + 13 = 100 = 'd'.
0 09 08 00  Set cell[ 9] to cell[ 8] + cell[0] = 100 +  1 = 101 = 'e'.
0 12 09 02  Set cell[12] to cell[ 9] + cell[2] = 101 + 13 = 114 = 'r'.
1 11 12 01  Set cell[11] to cell[12] - cell[1] = 114 -  3 = 111 = 'o'.
1 10 11 01  Set cell[10] to cell[11] + cell[1] = 111 -  3 = 108 = 'l'.
5 06        Print cell[ 6] = 'H'.
5 09        Print cell[ 9] = 'e'.
5 10        Print cell[10] = 'l'.
5 10        Print cell[10] = 'l'.
5 11        Print cell[11] = 'o'.
5 05        Print cell[ 5] = ','.
5 03        Print cell[ 3] = ' '.
5 07        Print cell[ 7] = 'W'.
5 11        Print cell[11] = 'o'.
5 12        Print cell[12] = 'r'.
5 10        Print cell[10] = 'l'.
5 08        Print cell[ 8] = 'd'.
5 04        Print cell[ 4] = '!'.
4             End the program.


# Var'aQ, 20 bytes

"Hello, World!" cha'


Var'aQ nIv rur Hol. 'oH rut lo' jIH ngaj-ghItlh.

Note: ghu'vam laH mugh jIH vaj DaneH'a'.

• mughwI' vItu' 'oHbe' majQa'. – mbomb007 Sep 1 '15 at 14:48
• @mbomb007 Qo', jIHvaD pIch, bing pIch – Beta Decay Sep 1 '15 at 14:51
• What language is this? – LegionMammal978 Sep 28 '15 at 1:00
• @LegionMammal978 Klingon :) – Beta Decay Sep 28 '15 at 5:52

# Q, 16 bytes

1"Hello, World!"


Just Y to go and we have the alphabet :)

Bit of a late update, but thanks to Mauris, we now have at least one language for every letter of the alphabet :D

Thanks @AaronDavies

• Not quite the requested output. I think you want 1"Hello, World!"; (doesn't include the trailing newline; to add one, change the 1 to a -1). Note, also valid for k. – Aaron Davies Aug 29 '15 at 23:19

# 123, 282 267 bytes

22221121121112112222222211211112111211211222222221121121133121121312121122222222111211213
31211213122222222111211332113312112222221112112331123322222221111211111211222221111211211
22222222112111112112112112222222111112112112112222213312112131222222221121113321133121121


The newlines are only for cosmetic purposes. I'm fairly sure that this is not optimal.

Here is a slightly more readable (and also runnable) version:

H 22221121121112112
e 2222222112111121112112112
l 22222221121121133121121312
l 12112
o 22222221112112133121121312
, 2222222111211332113312112
2222211121123311233
W 222222211112111112112
o 222211112112112
r 2222222112111112112112112
l 222222111112112112112
d 2222133121121312
! 2222222112111332113312112
1


I started out by constructing an optimal linear code (i.e. one which doesn't use 3s which allow for loop). That is quite simple: for each character, determine which bytes to flip from the last one. Move to the right-most character that has to be flipped (with a series of 2s), then move back to the left with 1 for each byte that has to be flipped and 121 for each byte that shouldn't be flipped. Finally move to the writing index -2 and print the character with 21. Repeat. At the very end, move to index -1 with a trailing 1 in order for the program to terminate.

This jumble of 1s and 2s was generated with this CJam script, which you can run online here:

0c"Hello, World!"+2ew::^{
_{2b8Ue[1a/W<1a*_,'2*'1@W%{'1"121"?}/"12"}{;"12112"}?
}/
'1


Then I removed some repetition of ones and twos by inserting loops by hand. 3 works as follows: if the instruction pointer is to the left of index 0, skip the 3. Otherwise, jump to the previous 3 if the current bit is 1 or jump ahead to the next 3 if the bit is 0. So simple loops, repeating a code segment x can be constructed as 33x33 or 33x3 (depending on whether the termination condition is "current bit is zero" or "moved to a negative index"). Then I started enumerating some relevant simple loops and when they are applicable. I've been using these loops only when moving back through the bits to change one character code to the next. If we can use a loop here depends both on the current state of a bit a and the target state b. I'll be denoting this combined state of each position as [a b]. Now here are the relevant loops and the required position patterns in a regex-like syntax:

121:    (^|[0 0]|[0 1]) ([1 1])+ [0 0]
112:    (^|[1 1]) ([0 0])+ ([0 1]|[1 1])
211:    ([0 0]|[0 1]) ([1 1])+ [0 0] ([0 0]|[1 1])
121121: ([0 0]|[0 1]) ([1 1] ([1 1]|[0 0]))+ [0 0]


Listing out the combined states for each character, we can annotate the potential loops and how many bytes they'll save (each ___ annotates the character above; sometimes multiple loops are possible):

H [[0 0] [0 1] [0 0] [0 0] [0 1] [0 0] [0 0] [0 0]]
e [[0 0] [1 1] [0 1] [0 0] [1 0] [0 1] [0 0] [0 1]]
l [[0 0] [1 1] [1 1] [0 0] [0 1] [1 1] [0 0] [1 0]]
__________________121 -2
________________________121121 -3
l [[0 0] [1 1] [1 1] [0 0] [1 1] [1 1] [0 0] [0 0]]
o [[0 0] [1 1] [1 1] [0 0] [1 1] [1 1] [0 1] [0 1]]
__________________121 -2
__________________211 -2
________________________121121 -3
, [[0 0] [1 0] [1 1] [0 0] [1 1] [1 1] [1 0] [1 0]]
________________________211 -2
[[0 0] [0 0] [1 1] [0 0] [1 0] [1 0] [0 0] [0 0]]
____________112 -2
W [[0 0] [0 1] [1 0] [0 1] [0 0] [0 1] [0 1] [0 1]]
o [[0 0] [1 1] [0 1] [1 0] [0 1] [1 1] [1 1] [1 1]]
r [[0 0] [1 1] [1 1] [0 1] [1 0] [1 0] [1 1] [1 0]]
l [[0 0] [1 1] [1 1] [1 0] [0 1] [0 1] [1 0] [0 0]]
d [[0 0] [1 1] [1 1] [0 0] [1 0] [1 1] [0 0] [0 0]]
__________________121 -2
________________________121121 -3
! [[0 0] [1 0] [1 1] [0 0] [0 0] [1 0] [0 0] [0 1]]
________________________211 -2
`

Now I just picked the most profitable loop in each case and inserted it into the code.

I'm fairly certain that one could find a couple more loops that I've overlooked. But I also think that it's possible to find a significantly shorter solution that isn't based on anything a human would come up with. So far I have no idea how to efficiently search for such a solution automatically though, so I'll leave it at that for now.